ToolStripItem.Dock ToolStripItem.Dock ToolStripItem.Dock ToolStripItem.Dock Property

定义

获取或设置要停靠在其父控件上的 ToolStripItem 边框,并确定 ToolStripItem 如何随其父控件一起调整大小。Gets or sets which ToolStripItem borders are docked to its parent control and determines how a ToolStripItem is resized with its parent.

public:
 property System::Windows::Forms::DockStyle Dock { System::Windows::Forms::DockStyle get(); void set(System::Windows::Forms::DockStyle value); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.DockStyle Dock { get; set; }
member this.Dock : System.Windows.Forms.DockStyle with get, set
Public Property Dock As DockStyle

属性值

DockStyle 值之一。One of the DockStyle values. 默认值为 NoneThe default is None.

异常

注解

此属性仅适用于流布局。This property applies only to flow layouts.

使用属性可定义自动调整的ToolStripItem大小,因为其父控件调整大小。 DockUse the Dock property to define how a ToolStripItem is automatically resized as its parent control is resized. 例如,将设置DockLeft会导致ToolStripItem将自身与父控件的左边缘对齐,并在父控件调整大小时进行重设大小。For example, setting Dock to Left causes the ToolStripItem to align itself with the left edges of its parent control and to resize as the parent control is resized. 控件按其 Z 顺序停靠,这是窗体上的控件沿窗体的 Z 轴(深度)的可视化分层。Controls are docked in their Z-order, which is the visual layering of controls on a form along the form's Z-axis (depth).

控件可以停靠到其父容器的一个边缘,也可以停靠到所有边缘并填充父容器。A control can be docked to one edge of its parent container or can be docked to all edges and fill the parent container.

备注

AnchorDock属性是互相排斥。The Anchor and Dock properties are mutually exclusive. 一次只能设置一个,而最后一个集则优先。Only one can be set at a time, and the last one set takes precedence.

适用于