ToolStrip


The ToolStrip control displays a series of buttons, drop-downs, and other tools. The user can access these tools quickly without navigating through a series of menus, so they are most useful for performing frequently needed tasks. Menus are more appropriate for commands that are needed less often.

The following list shows the types of items that a ToolStrip may contain.

 ToolStripButton                ToolStripProgressBar ToolStripComboBox              ToolStripSeparator ToolStripDropDownButton        ToolStripSplitButton ToolStripLabel                 ToolStripTextBox

Figure G-27 shows each of these tools. The mouse is hovering over the ToolStripSplitButton so that the control is displaying its border and tooltip.

image from book
Figure G-27: The ToolStrip component contains tools the user may want to use frequently.

These tools are relatively straightforward. ToolStripButton is a button that sits on a ToolStrip, ToolStripComboBox is a combo box that sits on a ToolStrip, and so forth. The only tool that doesn’t correspond to another type of control is the SplitButton. This control is a button with a drop-down area. If the user clicks the button, it raises a Click event. If the user clicks the drop-down arrow, the control displays a drop-down menu containing menu items that the user can select as usual. See the online help (msdn2.microsoft.com/library/system.windows.forms.toolstrip.aspx) for more information on SplitButton and the other tool control classes.

The ToolStrip control stores its tools in its Items collection. At runtime, a program can access the controls inside this collection, or it can refer to the tools directly by name. At design time, you can select a ToolStrip, click on its Items property in the Properties window, and click the ellipsis to the right to display the Items Collection Editor shown in Figure G-28.

image from book
Figure G-28: You can use the Items Collection Editor to define a ToolStrip’s tools at design time.

You can also click on the ToolStrip and add items to it much as you edit a MenuStrip control.

The following table describes the ToolStrip control’s most useful properties.

Open table as spreadsheet

Property

Purpose

AllowItemReorder

Determines whether the user can drag and drop items to reorder them.

AllowMerge

Determines whether the ToolStrip can merge with others.

CanOverflow

Determines whether items can be sent to an overflow menu if the ToolStrip doesn’t fit completely on the form.

GripDisplayStyle

Gets the orientation of the control’s move handle.

GripMargin

Determines the space around the control’s move handle.

GripRectangle

Gets the boundaries of the control’s move handle.

GripStyle

Determines whether the control’s move handle is visible or hidden.

Items

Returns a collection of ToolStripItem objects representing the control’s tools.

OverflowButton

Returns a ToolStripItem representing the control’s overflow button.

ShowItemToolTips

Determines whether the control’s tools display their tooltips.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net