Tool Bar

A ToolBar is a dockable window that contains a number of buttons; an application can have more than one ToolBar, and they are usually docked at the top of the main window. The ToolBar class contains a number of methods and properties that help you create and work with toolbars.

Each ToolBar object has a Buttons property that represents the collection of ToolBarButton objects displayed by the ToolBar. You can use the normal collection methods (Add(), Remove(), Clear()) to manage the buttons or make use of the Editor dialog provided by Visual Studio.

ToolBar buttons can be of three types—normal, toggle, and drop-down—and can display text, an image, or both. A toggle button toggles between its up and down state, whereas a drop-down button displays a menu when an arrow next to the button is pressed.

Table 10.29 lists important properties of the ToolBar class.

Table 10.29: Iprtlpiprtift its




Determines whether the ToolBar buttons are flat or 3D.


Determines the ToolBar border. The default is no border.


The collection of ToolBarButton objects hosted by the ToolBar.


The size of the buttons on the ToolBar; the default is 22 pixels high by 24 pixels wide.


True if the ToolBar displays a divider between it and the menu.


True if drop-down buttons will display arrows.


Represents the collection of images for the ToolBar buttons.


Represents the size of each image in the ImageList.


True if tooltips are to be shown for each button.


Represents the alignment of text and images on ToolBar buttons. The default is ToolBarTextAlign.Underneath.


True if buttons will wrap to a new line when the ToolBar gets too narrow.

The images to be displayed on the buttons are held by an ImageList object associated with the ToolBar.

0 0

Post a comment