다음을 통해 공유


Color.A 속성

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

네임스페이스: System.Drawing
어셈블리: System.Drawing(system.drawing.dll)

구문

‘선언
Public ReadOnly Property A As Byte
‘사용 방법
Dim instance As Color
Dim value As Byte

value = instance.A
public byte A { get; }
public:
property unsigned char A {
    unsigned char get ();
}
/** @property */
public byte get_A ()
public function get A () : byte

속성 값

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

예제

다음 코드 예제에서는 Colorop_Implicit 멤버의 G, B, RA 속성을 보여 줍니다.

이 예제는 Windows Form과 함께 사용해야 합니다. 폼에 코드를 붙여넣은 후 폼의 Paint 이벤트 처리 메서드에서 ShowPropertiesOfSlateBlue 메서드를 호출하고 e를 PaintEventArgs로 전달합니다.

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
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));
}
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");
    ubyte g = slateBlue.get_G();
    ubyte b = slateBlue.get_B();
    ubyte r = slateBlue.get_R();
    ubyte a = slateBlue.get_A();
    String text = String.Format(
        "Slate Blue has these ARGB values: Alpha:{0}, "  
        + "red:{1}, green: {2}, blue {3}", 
        new Object[] { (UInt16)a, (UInt16)r, (UInt16)g, (UInt16)b });

    e.get_Graphics().DrawString(text, 
        new Font(this.get_Font(), FontStyle.Italic), 
        new SolidBrush(slateBlue), 
        new RectangleF(new PointF(0, 0), 
        Size.op_Implicit(this.get_Size())));
} //ShowPropertiesOfSlateBlue

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

Color 구조체
Color 멤버
System.Drawing 네임스페이스