AnnHitTestExt example for Visual Basic
'This example uses the caller's mouse coordinates to get the handle
' to the annotation object at the specified coordinates.
' The part of the clicked annotation is displayed in the Output window.
' If the result of the hittest is a user handle, additional information about the handle is displayed.
Private Sub ExampleAnnHitTestExt(hContainer As Long, PointToTestX As Long, PointToTestY As Long, hAnnObject As Long)
Dim szResult As String
RasterAnn.AnnHitTestExt hContainer, PointToTestX, PointToTestY
If RasterAnn.ObjectHitHandle = 0 Then
MsgBox "There is no object to hit test."
Exit Sub
End If
Select Case RasterAnn.PositionResult
Case ANN_HIT_NONE
szResult = "ANN_HIT_NONE"
Case ANN_HIT_BODY
szResult = "ANN_HIT_BODY"
Case ANN_HIT_NAME
szResult = "ANN_HIT_NAME"
Case ANN_HIT_HANDLE
szResult = "ANN_HIT_HANDLE HandleIndex = " + Chr(RasterAnn.HandleIndex) + "HandleId = " + Chr(RasterAnn.HandleID)
Case ANN_HIT_USER_HANDLE
szResult = "ANN_HIT_USER_HANDLE HandleIndex = " + Chr(RasterAnn.HandleIndex) + "HandleId = " + Chr(RasterAnn.HandleID)
End Select
MsgBox szResult
End Sub