Form.Size Özellik

Tanım

Formun boyutunu alır veya ayarlar.

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

Özellik Değeri

Size

Size Formun boyutunu temsil eden bir.

Örnekler

Aşağıdaki örnek, yüzde 75 opaklık düzeyiyle görüntülenen bir formun nasıl oluşturulacağını gösterir. Örnek kod, formun opaklık düzeyini değiştirmek için ayarlanmış bir özellik ile ekranın ortasına konumlandırılmış yeni bir Opacity form oluşturur. Örnek kod ayrıca özelliğini, formun Size varsayılan boyutundan daha büyük boyutlu bir form sağlayacak şekilde ayarlar. Bu örnek, bu örnekte tanımlanan yöntemin bir olay işleyicisindeki veya başka bir yöntemdeki başka bir formdan çağrılsını gerektirir.

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

Açıklamalar

Bu özellik, ve Width özelliklerini ayrı ayrı ayarlamak yerine formun hem yüksekliğini hem de genişliğini (piksel cinsinden) aynı anda ayarlamanıza Height olanak tanır. Formun boyutunu ve konumunu ayarlamak istiyorsanız, masaüstü koordinatlarına göre formu boyutlandırmak ve bulmak için özelliğini kullanabilir DesktopBounds veya formun Control boyutunu ve konumunu ekran koordinatlarına göre ayarlamak için sınıfın özelliğini kullanabilirsinizBounds.

Not

Bu özelliğin en büyük değeri, formun çalıştığı ekranın çözünürlüğüyle sınırlıdır. Değer her ekran boyutu üzerinde 12 pikselden büyük olamaz (yatay + 12 ve dikey + 12).

Not

Pocket PC cihazlarda, herhangi MainMenu bir denetimi ayarlayarak FormBorderStyle None ve kaldırarak yeniden boyutlandırılabilir bir pencere oluşturabilirsiniz. SmartPhone cihazlarında, hiçbir zaman yeniden Form boyutlandıramazsınız; her zaman ekranın tamamını doldurur.

Şunlara uygulanır

Ayrıca bkz.