ToolStripLayoutStyle 枚举

定义

指定显示 ToolStrip 的项时可能使用的对齐方式。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
继承
ToolStripLayoutStyle

字段

Flow 3

根据需要指定项按水平方向或垂直方向排列。Specifies that items flow horizontally or vertically as necessary.

HorizontalStackWithOverflow 1

指定项按水平方向进行布局且必要时会溢出。Specifies that items are laid out horizontally and overflow as necessary.

StackWithOverflow 0

指定项按自动方式进行布局。Specifies that items are laid out automatically.

Table 4

指定项的布局方式为左对齐。Specifies that items are laid out flush left.

VerticalStackWithOverflow 2

指定项按垂直方向进行布局,在控件中居中且必要时会溢出。Specifies that items are laid out vertically, are centered within the control, and overflow as necessary.

注解

通过将ToolStripLayoutStyle枚举的成员分配ToolStrip给控件的LayoutStyle属性 (例如ToolStrip.LayoutStyleStatusStrip.LayoutStyle属性), 可以控制该类及其派生类的布局。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 会导致工具条根据控件的Orientation属性自动更改其布局, 以便处理拖放和停靠方案。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 垂直呈现Orientation项。VerticalStackWithOverflow renders the Orientation items beside each other vertically.

  • HorizontalStackWithOverflow 水平呈现Orientation项。HorizontalStackWithOverflow renders the Orientation items beside each other horizontally.

堆栈布局的其他功能Other Features of Stack Layouts

Alignment确定项要对齐到HorizontalStackWithOverflow的末尾。Alignment determines the end of the HorizontalStackWithOverflow to which the item is aligned.

当项不适合于ToolStrip时, 会自动显示溢出按钮。When items do not fit within the ToolStrip, an overflow button automatically appears. Overflow属性设置确定某项是否始终出现在溢出区中 (根据需要) 或从不出现。The Overflow property setting determines whether an item appears in the overflow area always, as needed, or never.

在此LayoutCompleted事件中, 你可以Placement检查属性, 以确定项是放置在主Overflow位置、溢出LayoutCompleted还是当前根本不显示。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. 项未显示的典型原因是项不适合 main Placement , 其Overflow属性设置为ToolStripItemOverflowThe 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.

将其ToolStripToolStripPanel入, 并将其GripStyle设置为ToolStripGripStyle, 使成为可移动的。Make a ToolStrip movable by putting it in a ToolStripPanel and setting its GripStyle to ToolStripGripStyle.

其他布局选项Other Layout Options

其他布局选项是 Flow 和 Table。The other layout options are Flow and Table.

流布局Flow Layout

流布局是ContextMenuStripToolStripDropDownMenuToolStripOverflow的默认值。Flow layout is the default for ContextMenuStrip, ToolStripDropDownMenu, and ToolStripOverflow. 它类似FlowLayoutPanel于。It is similar to the FlowLayoutPanel. 流布局的功能如下所示:The features of Flow layout are as follows:

表布局Table Layout

表布局是的默认值StatusStripTable layout is the default for StatusStrip. 它类似于TableLayoutPanelIt is similar to TableLayoutPanel. 表布局的功能如下所示:The features of Table layout are as follows:

适用于