Jump to content
Software FX Community

PaintMarker Event


Recommended Posts

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


  .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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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? 




Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...