Create 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 creates an annotation toolbar and adds a button to the toolbar.
'The button displays different images when selected/deselected
'The button has two tools associated with (line and button tool)
Private Sub CreateToolBar_Click()
Dim Rasterio As New LEADRasterIO
RasterAnnToolbar.AnnParentRasterView = LEADRasterView1
RasterAnnToolbar.Visible = True
RasterAnnToolbar.Create 0, 0, ANN_TOOLALIGN_TOP
If RasterAnnToolbar.ToolBarhWnd Then
RasterAnnToolbar.ButtonTool(RasterAnnToolbar.ButtonCount) = ANN_TOOL_USER_FIRST
RasterIO.Load LEADRasterView2.Raster, "e:\lead14\dist\images\Ulay1.bmp", 0, 0, 1
RasterAnnToolbar.ButtonBitmapUp(RasterAnnToolbar.ButtonCount) = LEADRasterView2.Raster.Bitmap
RasterIO.Load LEADRasterView2.Raster, "e:\lead14\dist\images\Ulay2.bmp", 0, 0, 1
RasterAnnToolbar.ButtonBitmapDown(RasterAnnToolbar.ButtonCount) = LEADRasterView2.Raster.Bitmap
RasterAnnToolbar.ButtonToolTipTextID(RasterAnnToolbar.ButtonCount) = -1
RasterAnnToolbar.ButtonToolTipText(RasterAnnToolbar.ButtonCount) = "User defined tool"
MsgBox "AnnToolTipText: " & RasterAnnToolbar.ButtonToolTipText(RasterAnnToolbar.ButtonCount)
RasterAnnToolbar.ButtonToolCount(RasterAnnToolbar.ButtonCount) = 2
RasterAnnToolbar.ButtonMenuTool(RasterAnnToolbar.ButtonCount, 0) = ANN_TOOL_LINE
RasterAnnToolbar.ButtonMenuTextID(RasterAnnToolbar.ButtonCount, 0) = -1
RasterAnnToolbar.ButtonMenuText(RasterAnnToolbar.ButtonCount, 0) = "User defined tool"
RasterAnnToolbar.ButtonMenuTool(RasterAnnToolbar.ButtonCount, 1) = ANN_TOOL_BUTTON
RasterAnnToolbar.ButtonMenuTextID(RasterAnnToolbar.ButtonCount, 1) = -1
RasterAnnToolbar.ButtonMenuText(RasterAnnToolbar.ButtonCount, 1) = "Button"
RasterAnnToolbar.ButtonCount = RasterAnnToolbar.ButtonCount + 1
RasterAnn.AnnUserMode = ANN_USERMODE_DESIGN
RasterAnn.AutoSetTool = True
End If
End Sub