Form.Opacity Özellik

Tanım

Formun opaklık düzeyini alır veya ayarlar.

public:
 property double Opacity { double get(); void set(double value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.OpacityConverter))]
public double Opacity { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.OpacityConverter))>]
member this.Opacity : double with get, set
Public Property Opacity As Double

Özellik Değeri

Formun opaklık düzeyi. Varsayılan değer 1.00'dir.

Öznitelikler

Ö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. 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 ayrıca özelliği, formun Size varsayılan boyutundan daha büyük boyutlu bir form sağlayacak şekilde ayarlar.

Bu örnekte, yönteminin CreateMyOpaqueForm bir olay işleyicisindeki veya başka bir yöntemdeki başka bir formdan çağrıldığı varsayılır.

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

özelliği, Opacity form ve denetimleri için bir saydamlık düzeyi belirtmenize olanak tanır. Bu özellik yüzde 100'den (1,00) küçük bir değere ayarlandığında, kenarlıklar da dahil olmak üzere formun tamamı daha saydam hale getirilir. Bu özelliğin yüzde 0 (0,00) değerine ayarlanması formun tamamen görünmez olmasını sağlar. Bu özelliği, farklı saydamlık düzeyleri sağlamak ya da formu görünümde veya görünüm dışı olarak phasing gibi efektler sağlamak için kullanabilirsiniz. Örneğin, özelliği yüzde 0 (0,00) değerine ayarlayarak Opacity ve değeri yüzde 100'e (1,00) ulaşana kadar kademeli olarak artırarak formu görünüme dönüştürebilirsiniz.

Opacity tarafından sağlanan TransparencyKeysaydamlıktan farklıdır. Bu saydamlık, yalnızca özelliğinde TransparencyKey belirtilen değerle aynı renkse formu ve denetimlerini tamamen saydam hale getirir.

Bu özellik, olduğunda RightToLeftLayouttruedesteklenmez.

Opacity özelliği Katmanlı Windows API'sine bağlıdır. Daha fazla bilgi için bkz . Katmanlı Windows.

Şunlara uygulanır

Ayrıca bkz.