Color.A 속성

정의

Color 구조체의 알파 구성 요소 값을 가져옵니다.

public:
 property System::Byte A { System::Byte get(); };
public byte A { get; }
member this.A : byte
Public ReadOnly Property A As Byte

속성 값

Color의 알파 구성 요소 값입니다.

예제

다음 코드 예제에서는 A, , RGB 의 속성을 보여 줍니다는 Color및 멤버입니다Implicit.

이 예제는 Windows Form과 함께 사용하도록 설계되었습니다. 코드를 양식에 붙여넣고 양식의 Paint 이벤트 처리 메서드에서 메서드를 호출 ShowPropertiesOfSlateBlue 하여 로 PaintEventArgs전달 e 합니다.

void ShowPropertiesOfSlateBlue( PaintEventArgs^ e )
{
   Color slateBlue = Color::FromName( "SlateBlue" );
   Byte g = slateBlue.G;
   Byte b = slateBlue.B;
   Byte r = slateBlue.R;
   Byte a = slateBlue.A;
   array<Object^>^temp0 = {a,r,g,b};
   String^ text = String::Format( "Slate Blue has these ARGB values: Alpha:{0}, "
   "red:{1}, green: {2}, blue {3}", temp0 );
   e->Graphics->DrawString( text, gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), gcnew SolidBrush( slateBlue ), RectangleF(PointF(0.0F,0.0F),this->Size) );
}
private void ShowPropertiesOfSlateBlue(PaintEventArgs e)
{
    Color slateBlue = Color.FromName("SlateBlue");
    byte g = slateBlue.G;
    byte b = slateBlue.B;
    byte r = slateBlue.R;
    byte a = slateBlue.A;
    string text = String.Format("Slate Blue has these ARGB values: Alpha:{0}, " +
        "red:{1}, green: {2}, blue {3}", new object[]{a, r, g, b});
    e.Graphics.DrawString(text, 
        new Font(this.Font, FontStyle.Italic), 
        new SolidBrush(slateBlue), 
        new RectangleF(new PointF(0.0F, 0.0F), this.Size));
}
Private Sub ShowPropertiesOfSlateBlue(ByVal e As PaintEventArgs)
    Dim slateBlue As Color = Color.FromName("SlateBlue")
    Dim g As Byte = slateBlue.G
    Dim b As Byte = slateBlue.B
    Dim r As Byte = slateBlue.R
    Dim a As Byte = slateBlue.A
    Dim text As String = _
    String.Format("Slate Blue has these ARGB values: Alpha:{0}, " _
       & "red:{1}, green: {2}, blue {3}", New Object() {a, r, g, b})
    e.Graphics.DrawString(text, New Font(Me.Font, FontStyle.Italic), _
        New SolidBrush(slateBlue), _
        New RectangleF(New PointF(0.0F, 0.0F), _
        Size.op_Implicit(Me.Size)))
End Sub

설명

각 픽셀의 색은 알파, 빨강, 녹색 및 파랑(ARGB)의 경우 각각 8비트인 32비트 숫자로 표시됩니다. 알파 구성 요소는 색의 투명도를 지정합니다. 0은 완전히 투명하고 255는 완전히 불투명합니다. 마찬가지로 A 값 255는 불투명 색을 나타냅니다. A 1에서 254까지의 값은 반투명 색을 나타냅니다. 255에 가까워지면 A 색이 더 불투명해집니다.

적용 대상