AnnAutomation Property 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 shows how you can use the AnnAutomation property
'to access the automation object through API functions.
Private Sub AnnAutomation_Click()
Dim nRet As Integer
Dim IsBold As Long ' Is the object's text bold
Dim hAnnObject As Long
hAnnObject = RasterAnn.AnnAutomation
' Toggle the default font bold property
L_AnnGetFontBold hAnnObject, IsBold
If IsBold <> 0 Then
MsgBox "Removing bold", 0, "Notice"
Else
MsgBox "Making bold", 0, "Notice"
End If
nRet = L_AnnSetFontBold(hAnnObject, Not IsBold, 0)
If (nRet <> 1) Then
MsgBox "L_AnnSetFontBold failed: " & nRet
End If
End Sub