ToolStripItem.Anchor 屬性

定義

取得或設定 ToolStripItem 繫結容器的目的邊緣,並決定 ToolStripItem 隨其父代調整大小的方式。Gets or sets the edges of the container to which a ToolStripItem is bound and determines how a ToolStripItem is resized with its parent.

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

屬性值

AnchorStyles

其中一個 AnchorStyles 值。One of the AnchorStyles values.

屬性

例外狀況

該值不是其中一個 AnchorStyles 值。The value is not one of the AnchorStyles values.

備註

Anchor 可以使用屬性來定義如何 ToolStripItem 自動調整大小,因為其父控制項已調整大小。Use the Anchor property to define how a ToolStripItem is automatically resized as its parent control is resized. 將控制項錨定至其父控制項,可確保錨定的邊緣在調整父控制項的大小時,會維持與父控制項邊緣的相同位置。Anchoring a control to its parent control ensures that the anchored edges remain in the same position relative to the edges of the parent control when the parent control is resized.

注意

AnchorDock 屬性是互斥的。The Anchor and Dock properties are mutually exclusive. 一次只能設定一個,而最後一個設定優先。Only one can be set at a time, and the last one set takes precedence.

適用於