Form.Opacity 속성

정의

폼의 불투명도를 가져오거나 설정합니다.

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

속성 값

Double

폼의 불투명도입니다. 기본값은 1.00입니다.

특성

예제

다음 예제에서는 불투명도 수준이 75%인 폼을 만드는 방법을 보여 줍니다. 폼의 불투명도 수준을 변경하는 속성이 설정된 화면 Opacity 가운데에 배치되는 새 폼을 만듭니다. 또한 이 예제에서는 폼의 Size 기본 크기보다 큰 크기의 폼을 제공하도록 속성을 설정합니다.

이 예제에서는 메서드가 CreateMyOpaqueForm 이벤트 처리기 또는 다른 메서드의 다른 양식에서 호출된다고 가정합니다.

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

설명

Opacity 속성을 사용하면 양식 및 해당 컨트롤의 투명도 수준을 지정할 수 있습니다. 이 속성을 100%(1.00) 미만의 값으로 설정하면 테두리를 포함한 전체 양식이 더 투명해집니다. 이 속성을 0%(0.00) 값으로 설정하면 양식이 완전히 보이지 않습니다. 이 속성을 사용하여 다양한 수준의 투명도를 제공하거나 폼을 보기 내/외부로 단계별로 수행하는 등의 효과를 제공할 수 있습니다. 예를 들어 속성을 0%(0.00) 값으로 설정하고 Opacity 100%(1.00)에 도달할 때까지 값을 점진적으로 늘려 폼을 보기로 단계화할 수 있습니다.

Opacity 은 속성에 TransparencyKey지정된 값과 같은 색인 경우에만 폼과 해당 컨트롤을 완전히 투명하게 만드는 투명도와 TransparencyKey 다릅니다.

이 속성은 다음과 같은 true경우 RightToLeftLayout 지원되지 않습니다.

이 속성은 Opacity 계층화된 Windows API에 따라 달라집니다. 자세한 내용은 계층화된 Windows를 참조하세요.

적용 대상

추가 정보