Jump to content
Software FX Community

Annotations collection and GetExtension


User (Legacy)
 Share

Recommended Posts

Is there a way to reference the Annotations collection once they are

imported on a chart using Import method?

I am using VB6 and running ChartfX1.Import method to import a chart that has

annotations in it.

I then need to get a reference to those annotations collection so that I can

add to them/remove them programmatically.

ChartFX1.GetExtension method returns an error. Omitting the call causes a

crash.

Celia

---------------------------------------------------

Sample Code:

Option Explicit

Private WithEvents CA As AnnotationX

Private Sub cmdExport_Click(Index As Integer)

ChartFX1.Export CHART_CFXOLEFILE, App.Path & "\Chart" & Index & ".chd"

End Sub

Private Sub cmdImport_Click(Index As Integer)

ChartFX1.Import CHART_CFXOLEFILE, App.Path & "\Chart" & Index & ".chd"

Set CA = Nothing

End Sub

Private Sub cmdRemoveAll_Click()

If CA Is Nothing Then

CA = ChartFX1.GetExtension("AnnotationX.AnnList")

End If

CA.Remove -1

ChartFX1.Refresh

End Sub

Private Sub Form_Load()

If CA Is Nothing Then

Set CA = New AnnotationX

ChartFX1.AddExtension CA

End If

End Sub

Private Sub Form_Unload(Cancel As Integer)

If Not CA Is Nothing Then

Set CA = Nothing

End If

End Sub

Private Sub cmdAddAnn_Click()

Dim r As AnnText

If CA Is Nothing Then

CA = ChartFX1.GetExtension("AnnotationX.AnnList")

End If

Set r = CA.Add(OBJECT_TYPE_TEXT)

r.Top = 80 - (CA.Count * 10)

r.Left = 100

r.Width = 100

r.Height = 40

r.Text = Now

r.BorderStyle = LS_SOLID

ChartFX1.Refresh

End Sub

Private Sub cmdCount_Click()

If CA Is Nothing Then

CA = ChartFX1.GetExtension("AnnotationX.AnnList")

End If

MsgBox "There are " & CA.Count & " annotations"

End Sub

Private Sub cmdMakeChanges_Click()

ChartFX1.Gallery = AREA

ChartFX1.Palette = "Dark Pastels"

ChartFX1.ToolBar = False

End Sub

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.

Guest
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.

 Share

×
×
  • Create New...