AnnSetTextOptions Example for Visual Basic
' The following example changes some of the text options of
' a text-based annotation. It changes the text color to blue,
' and toggles the ShowBorder option:
Private Sub ExampleAnnSetTextOptions_Click()
Dim nRet As Integer
Dim lOptions As Long
Dim szMsg As String
Dim hObject As Long
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
lOptions = RasterAnn.AnnGetOptions()
lOptions = lOptions Or ANN_OPTIONS_NEW_TEXT_OPTIONS
nRet = RasterAnn.AnnSetOptions(lOptions)
If (nRet <> 0) Then Exit Sub
nRet = RasterAnn.AnnGetTextOptions(hObject, ANN_TEXT_SHOW_TEXT Or ANN_TEXT_SHOW_BORDER Or ANN_TEXT_TEXTCOLOR)
If (nRet <> 0) Then Exit Sub
szMsg = "Old Options: AnnShowText[" + Str(RasterAnn.AnnShowText) + "], AnnShowBorder[" + Str(RasterAnn.AnnShowBorder) + "], AnnTextColor[" + Str(RasterAnn.AnnTextColor) + "]"
MsgBox szMsg
'Change some options
nRet = RasterAnn.AnnSetTextOptions(hObject, RasterAnn.AnnShowText, Not RasterAnn.AnnShowBorder, RGB(0, 0, 255), 0, ANN_TEXT_SHOW_BORDER Or ANN_TEXT_TEXTCOLOR, False)
If (nRet <> 0) Then Exit Sub
nRet = RasterAnn.AnnGetTextOptions(hObject, ANN_TEXT_SHOW_TEXT Or ANN_TEXT_SHOW_BORDER Or ANN_TEXT_TEXTCOLOR)
If (nRet <> 0) Then Exit Sub
szMsg = "new Options: AnnShowText[" + Str(RasterAnn.AnnShowText) + "], AnnShowBorder[" + Str(RasterAnn.AnnShowBorder) + "], AnnTextColor[" + Str(RasterAnn.AnnTextColor) + "]"
MsgBox szMsg
End Sub