영어로 읽기

다음을 통해 공유


Control.Left 속성

정의

컨트롤의 왼쪽 가장자리와 해당 컨테이너 클라이언트 영역의 왼쪽 가장자리 사이의 거리(픽셀)를 가져오거나 설정합니다.

[System.ComponentModel.Browsable(false)]
public int Left { get; set; }

속성 값

컨트롤의 왼쪽 가장자리와 해당 컨테이너 클라이언트 영역의 왼쪽 가장자리 사이의 거리(픽셀)를 나타내는 Int32 값입니다.

특성

예제

다음 코드 예제에서는 폼에 세 Button 개의 컨트롤을 만들고 다양한 크기 관련 및 위치 관련 속성을 사용하여 해당 크기와 위치를 설정합니다. 이 예제에서는 Form 너비와 높이가 300픽셀 이상인 가 있어야 합니다.

// Create three buttons and place them on a form using 
// several size and location related properties. 
private void AddOKCancelButtons()
{
   // Set the button size and location using 
   // the Size and Location properties.
   Button buttonOK = new Button();
   buttonOK.Location = new Point(136,248);
   buttonOK.Size = new Size(75,25);
   // Set the Text property and make the 
   // button the form's default button. 
   buttonOK.Text = "&OK";
   this.AcceptButton = buttonOK;

   // Set the button size and location using the Top, 
   // Left, Width, and Height properties.
   Button buttonCancel = new Button();
   buttonCancel.Top = buttonOK.Top;
   buttonCancel.Left = buttonOK.Right + 5;
   buttonCancel.Width = buttonOK.Width;
   buttonCancel.Height = buttonOK.Height;
   // Set the Text property and make the 
   // button the form's cancel button.
   buttonCancel.Text = "&Cancel";
   this.CancelButton = buttonCancel;

   // Set the button size and location using 
   // the Bounds property.
   Button buttonHelp = new Button();
   buttonHelp.Bounds = new Rectangle(10,10, 75, 25);
   // Set the Text property of the button.
   buttonHelp.Text = "&Help";

   // Add the buttons to the form.
   this.Controls.AddRange(new Control[] {buttonOK, buttonCancel, buttonHelp} );
}

설명

Left 속성 값은 컨트롤의 Point.X 속성 값 속성 Location 과 동일합니다.

WidthLeft 속성 값을 변경하면 컨트롤의 Right 속성 값이 변경될 수 있습니다.

적용 대상

제품 버전
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

추가 정보