System.Windows.Forms.ToolStripLayoutStyle Enumeration

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

Syntax

public enum ToolStripLayoutStyle

Remarks

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

Stack Layouts

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

Other Features of Stack Layouts

ToolStripItem.Alignment determines the end of the System.Windows.Forms.ToolStrip to which the item is aligned.

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

In the ToolStrip.LayoutCompleted event, you can inspect the ToolStripItem.Placement property to determine whether an item was placed on the main System.Windows.Forms.ToolStrip, the overflow System.Windows.Forms.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 System.Windows.Forms.ToolStrip and its ToolStripItem.Overflow property was set to ToolStripItemOverflow.Never.

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

Other Layout Options

The other layout options are ToolStripLayoutStyle.Flow and ToolStripLayoutStyle.Table.

Flow Layout

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

Table Layout

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

Members

Member NameDescription
Flow

Specifies that items flow horizontally or vertically as necessary.

HorizontalStackWithOverflow

Specifies that items are laid out horizontally and overflow as necessary.

StackWithOverflow

Specifies that items are laid out automatically.

Table

Specifies that items are laid out flush left.

VerticalStackWithOverflow

Specifies that items are laid out vertically, are centered within the control, and overflow as necessary.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0