Control.Location 속성

정의

해당 컨테이너의 왼쪽 위 모퉁이를 기준으로 컨트롤의 왼쪽 위 모퉁이의 좌표를 가져오거나 설정합니다.

public:
 property System::Drawing::Point Location { System::Drawing::Point get(); void set(System::Drawing::Point value); };
public System.Drawing.Point Location { get; set; }
member this.Location : System.Drawing.Point with get, set
Public Property Location As Point

속성 값

Point

해당 컨테이너의 왼쪽 위 모퉁이를 기준으로 하여 컨트롤의 왼쪽 위 모퉁이를 나타내는 Point입니다.

예제

다음 코드 예제에서는 공통 속성 중 일부를 만들고 GroupBox 설정합니다. 이 예에서는 만듭니다는 TextBox 설정 및 해당 Location 그룹 상자 내에서. 그런 다음 설정의 Text 그룹 상자 및 폼의 위쪽에 도킹 된 그룹 상자는 속성입니다. 마지막으로, 그룹 상자를 설정 하 여 비활성화 된 Enabled 속성을 false, 사용 하지 않도록 설정할 그룹 상자 내에 포함 된 모든 컨트롤에 이르게 합니다.

   // Add a GroupBox to a form and set some of its common properties.
private:
   void AddMyGroupBox()
   {
      // Create a GroupBox and add a TextBox to it.
      GroupBox^ groupBox1 = gcnew GroupBox;
      TextBox^ textBox1 = gcnew TextBox;
      textBox1->Location = Point(15,15);
      groupBox1->Controls->Add( textBox1 );

      // Set the Text and Dock properties of the GroupBox.
      groupBox1->Text = "MyGroupBox";
      groupBox1->Dock = DockStyle::Top;

      // Disable the GroupBox (which disables all its child controls)
      groupBox1->Enabled = false;

      // Add the Groupbox to the form.
      this->Controls->Add( groupBox1 );
   }
// Add a GroupBox to a form and set some of its common properties.
private void AddMyGroupBox()
{
   // Create a GroupBox and add a TextBox to it.
   GroupBox groupBox1 = new GroupBox();
   TextBox textBox1 = new TextBox();
   textBox1.Location = new Point(15, 15);
   groupBox1.Controls.Add(textBox1);

   // Set the Text and Dock properties of the GroupBox.
   groupBox1.Text = "MyGroupBox";
   groupBox1.Dock = DockStyle.Top;

   // Disable the GroupBox (which disables all its child controls)
   groupBox1.Enabled = false;

   // Add the Groupbox to the form.
   this.Controls.Add(groupBox1);
}
' Add a GroupBox to a form and set some of its common properties.
Private Sub AddMyGroupBox()
   ' Create a GroupBox and add a TextBox to it.
   Dim groupBox1 As New GroupBox()
   Dim textBox1 As New TextBox()
   textBox1.Location = New Point(15, 15)
   groupBox1.Controls.Add(textBox1)
   
   ' Set the Text and Dock properties of the GroupBox.
   groupBox1.Text = "MyGroupBox"
   groupBox1.Dock = DockStyle.Top
   
   ' Disable the GroupBox (which disables all its child controls)
   groupBox1.Enabled = False
   
   ' Add the Groupbox to the form.
   Me.Controls.Add(groupBox1)
End Sub

설명

클래스는 Point 값 형식(Structure Visual Basic의 struct 경우 Visual C#)이므로 값으로 반환됩니다. 즉, 속성에 액세스하면 컨트롤의 왼쪽 위 점 복사본이 반환됩니다. 따라서 이 속성에서 반환된 X 속성 또는 Y 속성을 조정해도 컨트롤의 Point , Right또는 Bottom Top속성 값에는 영향을 Left미치지 않습니다. 이러한 속성을 조정하려면 각 속성 값을 개별적으로 설정하거나 새 Point속성으로 속성을 설정합니다Location.

Control 이 값이면 Form속성 값은 Location 화면 좌표의 Form 왼쪽 위 모퉁이를 나타냅니다.

적용 대상

추가 정보