cz80pj Posted February 29, 2008 Report Share Posted February 29, 2008 I am setting a lable in the paintmarker event using annotation text for each bar in my chart. Using the following code: Set chLabel(i) = AnnotX.Add(OBJECT_TYPE_TEXT) With chLabel(i) .Attach ATTACH_NONE, Null .Text = "####" .Font.Size = 10 .height = ChartFX1.height .width = ChartFX1.width .SizeToFit .Left = x .Top = y .Refresh False End With This works greate but the PaintMarker Event will not stop from firing off. I have tried to set it off by reseting the TypeMask after processing all bars in the chart, but that doesn't seem to work. Why is the PaintMarker Event still firing off? ChartFX1.TypeMask = ChartFX1.TypeMask And Not CT_PAINTMARKER Private Sub ChartFX1_PaintMarker(ByVal x As Integer, ByVal y As Integer, _ ByVal lPaint As Long, ByVal nSerie As Integer, _ ByVal nPoint As Long, nRes As Integer) lngHDC = ChartFX1.PaintInfo(CPI_GETDC) Call SetChartLabel(nPoint, x, y) ChartFX1.PaintInfo CPI_RELEASEDC, lngHDC end sub Quote Link to comment Share on other sites More sharing options...
Frank Posted February 29, 2008 Report Share Posted February 29, 2008 ChartFX1.TypeMask = ChartFX1.TypeMask And Not CT_PAINTMARKER Where is this code running? What event? What is SetChartLabel(nPoint, x, y) doing. Is this the function adding the annotation? You can not make any changes to the chart (includding adding an annotation object or changing TypeMask) during a Paint event. Quote Link to comment Share on other sites More sharing options...
cz80pj Posted February 29, 2008 Author Report Share Posted February 29, 2008 The ChartFX1.TypeMask and Not CT_PAINTMARKER was being set in SetChartLabel(nPoint,x,y) when I reached max number of bars. However in PaintMarker is where I was calling SetChartLabel(nPoint, x, y) to set text on the bar with a displayed value. This function was adding the annotation at the sametime and this cause a looping issue with PaiantMarker Event. So, if I want to customize my char aftert it is loaded with data where should this done? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.