Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

ToolStripLayoutStyle Enumeration

Specifies the possible alignments with which the items of a ToolStrip can be displayed.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
public enum ToolStripLayoutStyle
Member nameDescription
StackWithOverflowSpecifies that items are laid out automatically.
HorizontalStackWithOverflowSpecifies that items are laid out horizontally and overflow as necessary.
VerticalStackWithOverflowSpecifies that items are laid out vertically, are centered within the control, and overflow as necessary.
FlowSpecifies that items flow horizontally or vertically as necessary.
TableSpecifies that items are laid out flush left.

You control ToolStrip layout by choosing one of the members of ToolStripLayoutStyle with the LayoutStyle property.

Stack Layouts

Stacking is the arranging of items beside each other at both ends of the ToolStrip. The following list describes the stack layouts.

  • StackWithOverflow is the default. This setting causes the ToolStrip to alter its layout automatically in accordance with the Orientation property to handle dragging and docking scenarios.

  • VerticalStackWithOverflow renders the ToolStrip items beside each other vertically.

  • HorizontalStackWithOverflow renders the ToolStrip items beside each other horizontally.

Other Features of Stack Layouts

Alignment determines the end of the ToolStrip to which the item is aligned.

When items do not fit within the ToolStrip, an overflow button automatically appears. The Overflow property setting determines whether an item appears in the overflow area always, as needed, or never.

In the LayoutCompleted event, you can inspect the Placement property to determine whether an item was placed on the main ToolStrip, the overflow ToolStrip, or if it is not currently showing at all. The typical reasons why an item is not displayed are that the item did not fit on the main ToolStrip and its Overflow property was set to Never.

Make a ToolStrip movable by putting it in a ToolStripPanel and setting its GripStyle to Visible.

Other Layout Options

The other layout options are Flow and Table.

Flow Layout

Flow layout is the default for ContextMenuStrip, ToolStripDropDownMenu, and ToolStripOverflow. It is similar to the FlowLayoutPanel. The features of Flow layout are as follows:

Table Layout

Table layout is the default for StatusStrip. It is similar to TableLayoutPanel. The features of Table layout are as follows:

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.