08-26-2005 10:30 AM
08-26-2005 02:59 PM
That shouldn't be happening. Could you please post a small test project that demonstrates the problem that you're seeing? Thanks.
- Elton
08-26-2005 03:21 PM
Hi Elton,
Attached is the sample project.
Max
08-26-2005 05:17 PM
The annotation isn't removed. What's happening is that you're always updating the properties for the first annotation that you added, and the same annotation is updated with the new coordinates each time that you click the button. If you change your code to always use the last index into the Item property, you will see the expected results. For example:
Private Sub Annotation_Click() S = S + 2 CWGraph1.Annotations.Add Dim index as Integer index = CWGraph1.Annotations.Count CWGraph1.Annotations.Item(index).Shape.XCoordinates = Array(S, S) CWGraph1.Annotations.Item(index).Shape.YCoordinates = Array(-10, 10) End Sub
Alternatively, you can use the return value of Add to update the most recently added annotation. For example:
Private Sub Annotation_Click() S = S + 2 Dim annotation As CWAnnotation Set annotation = CWGraph1.Annotations.Add annotation.Shape.XCoordinates = Array(S, S) annotation.Shape.YCoordinates = Array(-10, 10) End Sub
- Elton
08-27-2005 09:11 AM