VB中的 windows common controls-3 6.0 控件 也就是设置工具栏的

来源:百度知道 编辑:UC知道 时间:2024/05/21 22:15:47
VB中的 windows common controls-3 6.0 控件 也就是设置快捷工具栏的
怎么用啊。。。。 谢谢

怎样在里面添加 各种按钮啊,,,。, 也就是添加一些快捷工具...

以编程方式添加按钮
在过程中,创建工具栏按钮,方法是将这些按钮添加到 System.Windows.Forms.ToolBar.Buttons 集合中。

通过 Buttons 属性传递按钮的索引来指定单个按钮的属性设置。

下面的示例假定一个已添加了 ToolBar 控件的窗体。

注意
System.Windows.Forms.ToolBar.Buttons 集合是一个从零开始的集合,因此,编写代码时应使用相应的初始值。

Visual Basic 复制代码
Public Sub CreateToolBarButtons()
' Create buttons and set text property.
ToolBar1.Buttons.Add("One")
ToolBar1.Buttons.Add("Two")
ToolBar1.Buttons.Add("Three")
ToolBar1.Buttons.Add("Four")
' Set properties of StatusBar panels.
' Set Style property.
ToolBar1.Buttons(0).Style = ToolBarButtonStyle.PushButton
ToolBar1.Buttons(1).Style = ToolBarButtonStyle.Separator
ToolBar1.Buttons(2).Style = ToolBarButtonStyle.ToggleButton
ToolBar1.Buttons(3).Style = ToolBarButtonStyle.DropDownButton
' Set the ToggleButton's PartialPush property.
ToolBar1.Buttons(2)