AnnAutoSnapCursor Example for Visual Basic
' The following example toggles the automation cursor snap state.
' The cursor snap state affects whether the cursor snaps to a container border
' when creating annotations by clicking outside the annotation container.
Private Sub ExampleAnnSetAutoSnapCursor_Click()
Dim nRet As Integer
Dim szMsg As String
Dim hObject As Long
Dim bSnap As Boolean
RasterAnn.AnnCreate ANN_OBJECT_TEXT, True, True
hObject = RasterAnn.AnnObject
RasterAnn.AnnRectLeft (hObject) = 0
RasterAnn.AnnRectTop (hObject) = 0
RasterAnn.AnnRectWidth(hObject) = 100
RasterAnn.AnnRectHeight(hObject) = 100
bSnap = RasterAnn.AnnAutoSnapCursor
RasterAnn.AnnAutoSnapCursor = Not bSnap
szMsg = "Automation Snap Cursor State changed from " + Str(bSnap) + " to " + Str(RasterAnn.AnnAutoSnapCursor)
MsgBox szMsg
End Sub