将需要有下来菜单的按钮样式改为5-tbrDropdown,然后在下面的ButtonMenu中插入菜单,并填写相应的Text,Key等属性,最后在buttonmenuclick事件中编写代码:
Private Sub tbr_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
Select Case ButtonMenu.Key
Case "rwsp"
mnujob_rwsq_rwspb_Click
Case "yyxtlw"
mnujob_rwsq_yyxt_Click
Case "wdzd"
mnujob_rwsq_wdzd_Click
Case "wzkssp"
mnujob_wzgl_wzks_Click
Case "swxxdj"
mnujob_wzgl_swxx_Click
End Select
End Sub
Private Sub Form_Load()
Toolbar1.Buttons.Add 1, , "量测"
Toolbar1.Buttons(1).Style = tbrDropdown
Toolbar1.Buttons(1).ButtonMenus.Add 1, , "量测长度"
Toolbar1.Buttons(1).ButtonMenus.Add 2, , "量测面积"
End Sub
Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
If ButtonMenu.Parent = "量测" Then
If ButtonMenu.Index = 1 Then MsgBox "please measure the length of it"
If ButtonMenu.Index = 2 Then MsgBox "please measure the area of it"
End If
End Sub