ToolStrip.Anchor ToolStrip.Anchor ToolStrip.Anchor ToolStrip.Anchor Property

정의

ToolStrip이 바인딩되는 컨테이너의 가장자리를 가져오거나 설정하고 해당 부모를 기초로 ToolStrip 크기를 조정하는 방법을 결정합니다.Gets or sets the edges of the container to which a ToolStrip is bound and determines how a ToolStrip is resized with its parent.

public:
 virtual property System::Windows::Forms::AnchorStyles Anchor { System::Windows::Forms::AnchorStyles get(); void set(System::Windows::Forms::AnchorStyles value); };
public override System.Windows.Forms.AnchorStyles Anchor { get; set; }
member this.Anchor : System.Windows.Forms.AnchorStyles with get, set
Public Overrides Property Anchor As AnchorStyles

속성 값

AnchorStyles 값 중 하나입니다.One of the AnchorStyles values.

예제

다음 코드 예제에서는 일반적인 설정에 대 한 구문을 보여 줍니다 ToolStrip 속성을 포함 하는 Anchor 속성입니다.The following code example demonstrates the syntax for setting common ToolStrip properties, including the Anchor property.

// This is an example of some common ToolStrip property settings.
// 
toolStrip1.AllowDrop = false;
toolStrip1.AllowItemReorder = true;
toolStrip1.AllowMerge = false;
toolStrip1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
toolStrip1.AutoSize = false;
toolStrip1.CanOverflow = false;
toolStrip1.Cursor = System.Windows.Forms.Cursors.Cross;
toolStrip1.DefaultDropDownDirection = System.Windows.Forms.ToolStripDropDownDirection.BelowRight;
toolStrip1.Dock = System.Windows.Forms.DockStyle.None;
toolStrip1.GripMargin = new System.Windows.Forms.Padding(3);
toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
toolStripButton1});
toolStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
toolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
toolStrip1.Location = new System.Drawing.Point(0, 0);
toolStrip1.Margin = new System.Windows.Forms.Padding(1);
toolStrip1.Name = "toolStrip1";
toolStrip1.Padding = new System.Windows.Forms.Padding(0, 0, 2, 0);
toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
toolStrip1.ShowItemToolTips = false;
toolStrip1.Size = new System.Drawing.Size(109, 273);
toolStrip1.Stretch = true;
toolStrip1.TabIndex = 0;
toolStrip1.TabStop = true;
toolStrip1.Text = "toolStrip1";
toolStrip1.TextDirection = System.Windows.Forms.ToolStripTextDirection.Vertical90;
' This is an example of some common ToolStrip property settings.
' 
toolStrip1.AllowDrop = False
toolStrip1.AllowItemReorder = True
toolStrip1.AllowMerge = False
toolStrip1.Anchor = CType(System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right, System.Windows.Forms.AnchorStyles)
toolStrip1.AutoSize = False
toolStrip1.CanOverflow = False
toolStrip1.Cursor = Cursors.Cross
toolStrip1.Dock = System.Windows.Forms.DockStyle.None
toolStrip1.DefaultDropDownDirection = ToolStripDropDownDirection.BelowRight
toolStrip1.GripMargin = New System.Windows.Forms.Padding(3)
toolStrip1.ImageScalingSize = New System.Drawing.Size(20, 20)
toolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {toolStripButton1})
toolStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow
toolStrip1.Location = New System.Drawing.Point(0, 0)
toolStrip1.Margin = New System.Windows.Forms.Padding(1)
toolStrip1.Name = "toolStrip1"
toolStrip1.Padding = New System.Windows.Forms.Padding(0, 0, 2, 0)
toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System
toolStrip1.ShowItemToolTips = False
toolStrip1.Size = New System.Drawing.Size(109, 273)
toolStrip1.Stretch = True
toolStrip1.TabIndex = 0
toolStrip1.TabStop = True
toolStrip1.Text = "toolStrip1"
toolStrip1.TextDirection = System.Windows.Forms.ToolStripTextDirection.Vertical90

설명

사용 하 여는 Anchor 속성을 정의 하는 방법을 ToolStrip 부모 컨트롤의 크기를 조정할 때 자동으로 크기가 조정 됩니다.Use the Anchor property to define how a ToolStrip 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.

적용 대상