Form.Size 속성

정의

폼의 크기를 가져오거나 설정합니다.

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

속성 값

Size

폼의 크기를 나타내는 Size입니다.

예제

다음 예제에서는 불투명도 수준이 75%인 폼을 만드는 방법을 보여 줍니다. 예제 코드는 폼의 불투명도 수준을 변경하도록 설정된 속성을 사용하여 화면 Opacity 중앙에 배치되는 새 폼을 만듭니다. 또한 예제 코드는 폼의 Size 기본 크기보다 큰 크기의 폼을 제공하도록 속성을 설정합니다. 이 예제에서는 이 예제에 정의된 메서드가 이벤트 처리기 또는 다른 메서드의 다른 양식에서 호출되어야 합니다.

private:
   void CreateMyOpaqueForm()
   {
      // Create a new form.
      Form^ form2 = gcnew Form;

      // Set the text displayed in the caption.
      form2->Text = "My Form";

      // Set the opacity to 75%.
      form2->Opacity = .75;

      // Size the form to be 300 pixels in height and width.
      form2->Size = System::Drawing::Size( 300, 300 );

      // Display the form in the center of the screen.
      form2->StartPosition = FormStartPosition::CenterScreen;

      // Display the form as a modal dialog box.
      form2->ShowDialog();
   }
private void CreateMyOpaqueForm()
{
   // Create a new form.
   Form form2 = new Form();
   // Set the text displayed in the caption.
   form2.Text = "My Form";
   // Set the opacity to 75%.
   form2.Opacity = .75;
   // Size the form to be 300 pixels in height and width.
   form2.Size = new Size(300,300);
   // Display the form in the center of the screen.
   form2.StartPosition = FormStartPosition.CenterScreen;

   // Display the form as a modal dialog box.
   form2.ShowDialog();
}
Private Sub CreateMyOpaqueForm()
   ' Create a new form.
   Dim form2 As New Form()
   ' Set the text displayed in the caption.
   form2.Text = "My Form"
   ' Set the opacity to 75%.
   form2.Opacity = 0.75
   ' Size the form to be 300 pixels in height and width.
   form2.Size = New Size(300, 300)
   ' Display the form in the center of the screen.
   form2.StartPosition = FormStartPosition.CenterScreen

   ' Display the form as a modal dialog box.
   form2.ShowDialog()
End Sub

설명

이 속성을 사용하면 폼과 속성을 개별적으로 설정하는 대신 폼의 높이와 너비(픽셀 단위)를 동시에 설정할 Height Width 수 있습니다. 폼의 크기와 위치를 설정하려면 이 속성을 사용하여 DesktopBounds 데스크톱 좌표에 따라 폼의 크기를 지정하고 찾거나 클래스의 Control 속성을 사용하여 Bounds 화면 좌표에 따라 폼의 크기와 위치를 설정할 수 있습니다.

참고

이 속성의 최대값은 폼이 실행되는 화면의 해상도에 따라 제한됩니다. 값은 각 화면 차원(가로 + 12 및 세로 + 12)에서 12픽셀을 초과할 수 없습니다.

참고

Pocket PC 디바이스에서 설정 하 여 크기 조정 가능한 창의 만들 수 있습니다 FormBorderStyleNone 하나를 제거 하 고 MainMenu 제어 합니다. SmartPhone 디바이스에서 되지 크기를 조정할 수는 Form -전체 화면을 항상 채웁니다.

적용 대상

추가 정보