Control.SetBounds Control.SetBounds Control.SetBounds Control.SetBounds Method

정의

컨트롤의 범위를 설정합니다.Sets the bounds of the control.

오버로드

SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32)

컨트롤의 범위를 지정된 위치와 크기로 설정합니다.Sets the bounds of the control to the specified location and size.

SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified)

컨트롤의 지정된 범위를 특정 위치와 크기로 설정합니다.Sets the specified bounds of the control to the specified location and size.

SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32)

컨트롤의 범위를 지정된 위치와 크기로 설정합니다.Sets the bounds of the control to the specified location and size.

public:
 void SetBounds(int x, int y, int width, int height);
public void SetBounds (int x, int y, int width, int height);
member this.SetBounds : int * int * int * int -> unit
Public Sub SetBounds (x As Integer, y As Integer, width As Integer, height As Integer)

매개 변수

x
Int32 Int32 Int32 Int32

컨트롤의 새 Left 속성 값입니다.The new Left property value of the control.

y
Int32 Int32 Int32 Int32

컨트롤의 새 Top 속성 값입니다.The new Top property value of the control.

width
Int32 Int32 Int32 Int32

컨트롤의 새 Width 속성 값입니다.The new Width property value of the control.

height
Int32 Int32 Int32 Int32

컨트롤의 새 Height 속성 값입니다.The new Height property value of the control.

추가 정보

SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified) SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified)

컨트롤의 지정된 범위를 특정 위치와 크기로 설정합니다.Sets the specified bounds of the control to the specified location and size.

public:
 void SetBounds(int x, int y, int width, int height, System::Windows::Forms::BoundsSpecified specified);
public void SetBounds (int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified);
member this.SetBounds : int * int * int * int * System.Windows.Forms.BoundsSpecified -> unit
Public Sub SetBounds (x As Integer, y As Integer, width As Integer, height As Integer, specified As BoundsSpecified)

매개 변수

x
Int32 Int32 Int32 Int32

컨트롤의 새 Left 속성 값입니다.The new Left property value of the control.

y
Int32 Int32 Int32 Int32

컨트롤의 새 Top 속성 값입니다.The new Top property value of the control.

width
Int32 Int32 Int32 Int32

컨트롤의 새 Width 속성 값입니다.The new Width property value of the control.

height
Int32 Int32 Int32 Int32

컨트롤의 새 Height 속성 값입니다.The new Height property value of the control.

specified
BoundsSpecified BoundsSpecified BoundsSpecified BoundsSpecified

BoundsSpecified 값의 비트 조합입니다.A bitwise combination of the BoundsSpecified values. 매개 변수를 지정하지 않으면 현재 값이 사용됩니다.For any parameter not specified, the current value will be used.

예제

다음 코드 예제에서는 센터를 Form 화면에서 Layout 이벤트입니다.The following code example centers a Form on the screen in the Layout event. 이렇게 하면 폼 가운데에 사용자가 크기 조정으로 유지 됩니다.This will keep the form centered as the user resizes it. 이 예제에서는 만든를 Form 제어 합니다.This example requires that you have created a Form control.

private:
   void MyForm_Layout( Object^ /*sender*/, System::Windows::Forms::LayoutEventArgs^ /*e*/ )
   {
      // Center the Form on the user's screen everytime it requires a Layout.
      this->SetBounds( (Screen::GetBounds( this ).Width / 2) - (this->Width / 2), (Screen::GetBounds( this ).Height / 2) - (this->Height / 2), this->Width, this->Height, BoundsSpecified::Location );
   }
private void MyForm_Layout(object sender, System.Windows.Forms.LayoutEventArgs e)
{
   // Center the Form on the user's screen everytime it requires a Layout.
   this.SetBounds((Screen.GetBounds(this).Width/2) - (this.Width/2),
       (Screen.GetBounds(this).Height/2) - (this.Height/2),
       this.Width, this.Height, BoundsSpecified.Location);	
}

Private Sub MyForm_Layout(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.LayoutEventArgs) Handles MyBase.Layout

    ' Center the Form on the user's screen everytime it requires a Layout.
    Me.SetBounds((System.Windows.Forms.Screen.GetBounds(Me).Width / 2) - (Me.Width / 2), _
        (System.Windows.Forms.Screen.GetBounds(Me).Height / 2) - (Me.Height / 2), _
        Me.Width, Me.Height, System.Windows.Forms.BoundsSpecified.Location)
End Sub
추가 정보

적용 대상