ToolStripLayoutStyle ToolStripLayoutStyle ToolStripLayoutStyle ToolStripLayoutStyle Enum

Definition

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

public enum class ToolStripLayoutStyle
public enum ToolStripLayoutStyle
type ToolStripLayoutStyle = 
Public Enum ToolStripLayoutStyle
Inheritance
ToolStripLayoutStyleToolStripLayoutStyleToolStripLayoutStyleToolStripLayoutStyle

Fields

Flow Flow Flow Flow 3

Specifies that items flow horizontally or vertically as necessary.

HorizontalStackWithOverflow HorizontalStackWithOverflow HorizontalStackWithOverflow HorizontalStackWithOverflow 1

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

StackWithOverflow StackWithOverflow StackWithOverflow StackWithOverflow 0

Specifies that items are laid out automatically.

Table Table Table Table 4

Specifies that items are laid out flush left.

VerticalStackWithOverflow VerticalStackWithOverflow VerticalStackWithOverflow VerticalStackWithOverflow 2

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

Remarks

You control the layout of the ToolStrip class and its derived classes by assigning a member of the ToolStripLayoutStyle enumeration to the control's LayoutStyle property, such as the ToolStrip.LayoutStyle or StatusStrip.LayoutStyle property.

Stack Layouts

Stacking arranges items beside each other at both ends of the tool strip. The following list describes the stack layouts.

  • StackWithOverflow causes the tool strip to alter its layout automatically in accordance with the control's Orientation property to handle dragging and docking scenarios.

  • VerticalStackWithOverflow renders the Orientation items beside each other vertically.

  • HorizontalStackWithOverflow renders the Orientation items beside each other horizontally.

Other Features of Stack Layouts

Alignment determines the end of the HorizontalStackWithOverflow 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 Overflow, the overflow LayoutCompleted, 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 Placement and its Overflow property was set to ToolStripItemOverflow.

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

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:

Applies to