Color.FromArgb Method (Int32)

 

Creates a Color structure from a 32-bit ARGB value.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

static member FromArgb : 
        argb:int -> Color

Parameters

argb
Type: System.Int32

A value specifying the 32-bit ARGB value.

Return Value

Type: System.Drawing.Color

The Color structure that this method creates.

The byte-ordering of the 32-bit ARGB value is AARRGGBB. The most significant byte (MSB), represented by AA, is the alpha component value. The second, third, and fourth bytes, represented by RR, GG, and BB, respectively, are the color components red, green, and blue, respectively.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates three brushes, each a different color. Each Color structure that is used to create a brush is created from a 32-bit ARGB value.

  • Uses an imaginary triangle to position three circles.

  • Paints three overlapping circles, each centered on one vertex of the triangle, using a different brush for each circle.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: