展开全部
Private Sub Form_Load()
Toolbar1.Buttons(1).ButtonMenus.Add 1, , "a"
Toolbar1.Buttons(1).ButtonMenus.Add 2, , "b"
Toolbar1.Buttons(1).ButtonMenus.Add 3, , "c"
Toolbar1.Buttons(1).ButtonMenus.Add 4, , "..."
Toolbar1.Buttons(1).ButtonMenus.Add(5, , "d").Visible = False
Toolbar1.Buttons(1).ButtonMenus.Add(6, , "e").Visible = False
Toolbar1.Buttons(1).ButtonMenus.Add(7, , "f").Visible = False
Toolbar1.Buttons(1).ButtonMenus.Add(8, , "g").Visible = False
End Sub
Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
If ButtonMenu.Text = "..." Then
With Toolbar1.Buttons(1).ButtonMenus
.Item(4).Visible = False
.Item(8).Visible = True
.Item(5).Visible = True
.Item(6).Visible = True
.Item(7).Visible = True
End With
End If
End Sub
Toolbar1.Buttons(1).ButtonMenus.Add 1, , "a"
Toolbar1.Buttons(1).ButtonMenus.Add 2, , "b"
Toolbar1.Buttons(1).ButtonMenus.Add 3, , "c"
Toolbar1.Buttons(1).ButtonMenus.Add 4, , "..."
Toolbar1.Buttons(1).ButtonMenus.Add(5, , "d").Visible = False
Toolbar1.Buttons(1).ButtonMenus.Add(6, , "e").Visible = False
Toolbar1.Buttons(1).ButtonMenus.Add(7, , "f").Visible = False
Toolbar1.Buttons(1).ButtonMenus.Add(8, , "g").Visible = False
End Sub
Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
If ButtonMenu.Text = "..." Then
With Toolbar1.Buttons(1).ButtonMenus
.Item(4).Visible = False
.Item(8).Visible = True
.Item(5).Visible = True
.Item(6).Visible = True
.Item(7).Visible = True
End With
End If
End Sub
追问
谢谢,你教了我,添加和隐藏两个方法,太感激涕零了...
追答
嘿嘿 有事说话
展开全部
Toolbar1.Buttons(1).Style = tbrDefault
追问
不懂,意思,能详细点不,给新人点帮助吧,谢谢,
追答
把代码复制到你要隐藏菜单的事件中使用即可。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以通过动态增加或删除菜单项的方法来实现..
追问
求语法或代码?
来自:求助得到的回答
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询