Assembly : System.Drawing (dans system.drawing.dll)
SyntaxePublic ReadOnly Property R As Byte
Dim instance As Color Dim value As Byte value = instance.R
public byte R { get; }
public: property unsigned char R { unsigned char get (); }
/** @property */
public byte get_R ()
public function get R () : byte
Valeur de la propriété
Valeur du composant rouge de ce Color.
ExempleL'exemple de code suivant décrit les propriétés G, B, R et A d'un Color, et le membre op_Implicit.
Cet exemple est conçu pour être utilisé avec un Windows Form. Collez le code dans le formulaire et appelez la méthode ShowPropertiesOfSlateBlue à partir de la méthode de gestion d'événements Paint du formulaire, en passant l'argument e comme 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
Plates-formesWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.
Informations de version
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ