This documentation is archived and is not being maintained.

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:

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0