AnnSelect example for Visual Basic
'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
'This example for the AnnSelect event displays a message box showing the number of selected annotation objects. It then goes through the array of selected objects to see if any of them are polygons.
Private Sub RasterAnn_OnAnnSelect(ByVal aObjects As LEADRasterVariant, ByVal uCount As Integer)
Dim nType As AnnObjectType
Dim x As Integer
Dim nPolyCount As Integer
nPolyCount = 0
For x = 1 To uCount
RasterAnn.AnnGetType aObjects.LongItemValue (x - 1)
nType = RasterAnn.AnnType
If nType = ANN_OBJECT_POLYGON Then
nPolyCount = nPolyCount + 1
End If
Next
MsgBox CStr(uCount) & " objects were selected. " & nPolyCount & " Polygon Objects were selected"
End Sub