AnnGetPoint... example for Visual Basic
Note: Also works with Access 95 and 97.
Note: This topic is for Document/Medical only.
'Please note the following:
'LEADRasterView1 refers to a LEADRasterView control
'Global declarations
Private WithEvents RasterAnn As LEADRasterAnnotation
Private RasterAnnToolbar As LEADRasterAnnToolBar
'In the Form_Load method:
Set RasterAnn = New LEADRasterAnnotation
Set RasterAnnToolbar = New LEADRasterAnnToolBar
RasterAnn.AnnParentRasterView = LEADRasterView1
'In the AnnDrawn event, this example checks to see if the annotation object is a polygon.
'If it is a polygon, the example gets the number of points that define the object;
'then it gets the arrays of X and Y coordinates and displays the points in a message box.
Private Sub RasterAnn_OnAnnDrawn(ByVal hAnnObject As Long)
Dim nType As Long
Dim a As Integer
Dim RasterVarX As New LEADRasterVariant
Dim RasterVarY As New LEADRasterVariant
Dim nPoints As Long 'number of points in the object
Dim msgStr
RasterAnn.AnnGetType hAnnObject
nType = RasterAnn.AnnType
If nType = ANN_OBJECT_POLYGON Then 'Is the object a polygon?
MsgBox "Object is a Polygon"
RasterAnn.AnnGetPointCount hAnnObject
nPoints = RasterAnn.AnnPointCount 'get the number of points
RasterAnn.AnnGetPointX hAnnObject, RasterVarX 'get the X coordinates
RasterAnn.AnnGetPointY hAnnObject, RasterVarY 'get the Y coordinates
msgStr = "("
For a = 1 To nPoints
msgStr = msgStr & "{" & CStr(RasterVarX.FloatValue(a - 1)) & "," & CStr(RasterVarY.FloatValue(a - 1)) & "}"
Next
msgStr = msgStr & ")"
MsgBox msgStr, vbOKOnly, "The Polygon's " & CStr(nPoints) & " points are:"
End If
End Sub