AnnAddUserHandle example for Visual Basic
Private Sub ExampleAddAnnUserHandle(hRect As Long)
Dim AnnHandle As Long
Dim ObjectType As AnnObjectType
Dim RectTop As Double
Dim RectLeft As Double
Dim RectWidth As Double
Dim RectHeight As Double
RasterAnn.AnnGetType hRect
ObjectType = RasterAnn.AnnType
If ObjectType = ANN_OBJECT_RECT Then
RectTop = RasterAnn.AnnRectTop(hRect)
RectLeft = RasterAnn.AnnRectLeft(hRect)
RectWidth = RasterAnn.AnnRectWidth(hRect)
RectHeight = RasterAnn.AnnRectHeight(hRect)
RasterAnn.AnnHandle.ID = 100
RasterAnn.AnnHandle.EnableVisible = True
RasterAnn.AnnHandle.PenColor = RGB(0, 0, 0)
RasterAnn.AnnHandle.FillColor = RGB(255, 0, 0)
RasterAnn.AnnHandle.Shape = ANN_HANDLE_SHAPE_CIRCLE
RasterAnn.AnnHandle.hCursor = 0
RasterAnn.AnnHandle.Flags = ANN_HANDLE_ID Or _
ANN_HANDLE_LOCATION Or _
ANN_HANDLE_CONTAINER_COORDINATES Or _
ANN_HANDLE_VISIBLE Or _
ANN_HANDLE_PEN_COLOR Or _
ANN_HANDLE_FILL_COLOR Or _
ANN_HANDLE_SHAPE
RasterAnn.AnnHandle.ContainerX = RectLeft + (RectWidth / 2)
RasterAnn.AnnHandle.ContainerY = RectTop
RasterAnn.AnnAddUserHandle hRect
RasterAnn.AnnHandle.ContainerX = RectLeft + (RectWidth / 2)
RasterAnn.AnnHandle.ContainerY = RectTop + RectHeight
Else
MsgBox "Annotation object must be rectangle"
End If
End Sub