Form.SetDesktopBounds(Int32, Int32, Int32, Int32) 메서드

정의

폼의 경계를 데스크톱 좌표로 설정합니다.

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

매개 변수

x
Int32

폼 위치의 x 좌표입니다.

y
Int32

폼 위치의 y 좌표입니다.

width
Int32

폼의 너비입니다.

height
Int32

폼의 높이입니다.

예제

다음 예제에서는 메서드를 사용하는 방법을 SetDesktopBounds 보여 줍니다. 이 예제를 실행하려면 다음 코드를 이름이 지정된 Button2단추가 포함된 양식에 붙여넣습니다. 모든 이벤트가 해당 이벤트 처리기와 연결되어 있는지 확인합니다.

void Button2_Click( System::Object^ sender, System::EventArgs^ e )
{
   for ( int i = 0; i <= 20; i++ )
   {
      
      // With each loop through the code, the form's 
      // desktop location is adjusted right and down
      //  by 10 pixels and its height and width are each
      // decreased by 10 pixels. 
      this->SetDesktopBounds( this->Location.X + 10, this->Location.Y + 10, this->Width - 10, this->Height - 10 );
      
      // Call Sleep to show the form gradually shrinking.
      System::Threading::Thread::Sleep( 50 );

   }
}
private void Button2_Click(System.Object sender, System.EventArgs e)
{
    
    for(int i = 0; i <= 20; i++)
    {
        // With each loop through the code, the form's 
        // desktop location is adjusted right and down
        //  by 10 pixels and its height and width are each
        // decreased by 10 pixels. 
        this.SetDesktopBounds(this.Location.X+10, 
            this.Location.Y+10, this.Width-10, this.Height-10);

        // Call Sleep to show the form gradually shrinking.
        System.Threading.Thread.Sleep(50);
    }
}
Private Sub Button2_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button2.Click
    Dim i As Integer
    For i = 0 To 20
        ' With each loop through the code, the form's desktop location is 
        ' adjusted right and down by 10 pixels and its height and width 
        ' are each decreased by 10 pixels. 
        Me.SetDesktopBounds(Me.Location.X + 10, Me.Location.Y + 10, _
            Me.Width - 10, Me.Height - 10)

        ' Call Sleep to show the form gradually shrinking.
        System.Threading.Thread.Sleep(50)
    Next
End Sub

설명

바탕 화면 좌표는 작업 표시줄을 제외하는 화면의 작업 영역을 기반으로 합니다. 이 메서드를 사용하여 데스크톱에서 양식의 위치와 크기를 설정할 수 있습니다. 데스크톱 좌표는 양식의 작업 영역을 기반으로 하므로 이 메서드를 사용하여 폼이 바탕 화면에 완전히 표시되도록 할 수 있습니다.

적용 대상

추가 정보