Color.A Propiedad

Definición

Obtiene el valor del componente alfa de esta estructura Color.Gets the alpha component value of this Color structure.

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

Valor de propiedad

Valor del componente alfa de este Color.The alpha component value of this Color.

Ejemplos

En el ejemplo de código siguiente se muestran las propiedades A, R, Gy B de un Colory el miembro Implicit.The following code example demonstrates the A, R, G, and B properties of a Color, and the Implicit member.

Este ejemplo está diseñado para usarse con un Windows Form.This example is designed to be used with a Windows Form. Pegue el código en el formulario y llame al método ShowPropertiesOfSlateBlue desde el método de control de eventos Paint del formulario, pasando e como PaintEventArgs.Paste the code into the form and call the ShowPropertiesOfSlateBlue method from the form's Paint event-handling method, passing e as PaintEventArgs.

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

Comentarios

El color de cada píxel se representa como un número de 32 bits: 8 bits para alfa, rojo, verde y azul (ARGB).The color of each pixel is represented as a 32-bit number: 8 bits each for alpha, red, green, and blue (ARGB). El componente alfa especifica la transparencia del color: 0 es totalmente transparente y 255 es totalmente opaco.The alpha component specifies the transparency of the color: 0 is fully transparent, and 255 is fully opaque. Del mismo modo, un valor A de 255 representa un color opaco.Likewise, an A value of 255 represents an opaque color. Un valor A del 1 al 254 representa un color semitransparente.An A value from 1 through 254 represents a semitransparent color. El color se vuelve más opaco a medida que A enfoques 255.The color becomes more opaque as A approaches 255.

Se aplica a