Color.R Property
.NET Framework (current version)
Gets the red component value of this Color structure.
Assembly: System.Drawing (in System.Drawing.dll)
The color of each pixel is represented as a 32-bit number: 8 bits each for alpha, red, green, and blue (ARGB). Each of the four components is a number from 0 through 255, with 0 representing no intensity and 255 representing full intensity. Likewise,
R is a value from 0 to 255 with 0 representing no red and 255 representing fully red.
The following code example demonstrates the A, R, G, and B properties of a Color, and the Widening(Size to SizeF) member.
This example is designed to be used with a Windows Form. Paste the code into the form and call the ShowPropertiesOfSlateBlue method from the form's Paint event-handling method, passing e as 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
.NET Framework
Available since 1.1
Available since 1.1
Show: