ToolSelected Example VB

In this example, when the ToolSelected event fires, all of the annotation tool names that appear in the Tools menu are unchecked.  (There is one menu item for each annotation tool in the Annotation Tool Palette.)

Then, according to the value of the ToolID parameter, the procedure checks the menu item that corresponds to the annotation tool selected by the user.

Private Sub ImgEdit1_ToolSelected(ByVal ToolId As Integer)
    'This event could be used to keep menu selections in
    'sync with selections made from the Annotation Tool Palette
    'Initialize all menu selections to unchecked
    mnuToolsAnnoSelect.Checked = False
    mnuToolsFreeLine.Checked = False
    mnuToolsHighLine.Checked = False
    mnuToolsStraightLine.Checked = False
    mnuToolsHollowRect.Checked = False
    mnuToolsFilledRect.Checked = False
    mnuToolsText.Checked = False
    mnuToolsNote.Checked = False
    mnuToolsTextFile.Checked = False
    mnuToolsStamp.Checked = False
    mnuToolsHyperlinks.Checked = False
    'Use the ToolId parameter to determine which tool
    'the user selected and then check the corresponding
    'menu item.
    Select Case ToolId
       Case 1
         mnuToolsAnnoSelect.Checked = True
       Case 2
         mnuToolsFreeLine.Checked = True
        Case 3
          mnuToolsHighLine.Checked = True
        Case 4
          mnuToolsStraightLine.Checked = True
        Case 5
          mnuToolsHollowRect.Checked = True
        Case 6
          mnuToolsFilledRect.Checked = True
        Case 7
          mnuToolsText.Checked = True
        Case 8
          mnuToolsNote.Checked = True
        Case 9
          mnuToolsTextFile.Checked = True
        Case 10
          mnuToolsStamp.Checked = True
        Case 11
          mnuToolsHyperlinks.Checked = True
    End Select
End Sub