Color.A Özellik

Tanım

Bu Color yapının alfa bileşeni değerini alır.

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

Özellik Değeri

Bu Coloröğesinin alfa bileşeni değeri.

Örnekler

Aşağıdaki kod örneği, bir Ave üyesinin R, GB, Color ve Implicit özelliklerini gösterir.

Bu örnek, Bir Windows Formu ile kullanılacak şekilde tasarlanmıştır. Kodu forma yapıştırın ve olarak geçirerek formun ShowPropertiesOfSlateBlue olay işleme yönteminden yöntemini çağırınPaint.ePaintEventArgs

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

Açıklamalar

Her pikselin rengi 32 bit sayı olarak gösterilir: alfa, kırmızı, yeşil ve mavi (ARGB) için her biri 8 bit. Alfa bileşeni rengin saydamlığını belirtir: 0 tamamen saydamdır ve 255 tamamen opaktır. Benzer şekilde, A 255 değeri opak bir rengi temsil eder. A 1 ile 254 arasında bir değer, yarı saydam bir rengi temsil eder. 255'e yaklaştıkça A renk daha opak hale gelir.

Şunlara uygulanır