ButtonMenuTool 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

'Makes the first rubber stamp tool draw a rectangle
Public Sub SetToolToRect(AnnToolBar As LEADRasterAnnToolBar)
   Dim I As Integer
   For I = 0 To AnnToolBar.ButtonCount
      ' is this the button with the rubber stamps ?
      If AnnToolBar.ButtonToolCount(I) > 1 Then
          AnnToolBar.ButtonMenuTool(I, 0) = ANN_TOOL_RECT
      End If
   Next I
End Sub