Method FromArgb
FromArgb(int)
Creates a Color structure from a 32-bit ARGB value.
public static Color FromArgb(int argb)
Parameters
argb
intA value specifying the 32-bit ARGB value.
Returns
Remarks
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.
FromArgb(byte, byte, byte, byte)
Creates a Color structure from the four ARGB component (alpha, red, green, and blue) values.
public static Color FromArgb(byte alpha, byte red, byte green, byte blue)
Parameters
alpha
byteThe alpha component.
red
byteThe red component.
green
byteThe green component.
blue
byteThe blue component.
Returns
Remarks
To create an opaque color, set alpha to 255. To create a semitransparent color, set alpha to any value from 1 through 254.
FromArgb(int, int, int)
Creates a Color structure from the three RGB component (red, green, and blue) values. Although this method allows a 32-bit value to be passed for each component, the value of each component is limited to 8 bits.
public static Color FromArgb(int red, int green, int blue)
Parameters
red
intThe red component. Valid values are 0 through 255.
green
intThe green component. Valid values are 0 through 255.
blue
intThe blue component. Valid values are 0 through 255.
Returns
Remarks
This creates an opaque color (sets alpha to 255).
FromArgb(int, int, int, int)
Creates a Color structure from the four ARGB component (alpha, red, green, and blue) values. Although this method allows a 32-bit value to be passed for each component, the value of each component is limited to 8 bits.
public static Color FromArgb(int alpha, int red, int green, int blue)
Parameters
alpha
intThe alpha component. Valid values are 0 through 255.
red
intThe red component. Valid values are 0 through 255.
green
intThe green component. Valid values are 0 through 255.
blue
intThe blue component. Valid values are 0 through 255.
Returns
Remarks
To create an opaque color, set alpha to 255. To create a semitransparent color, set alpha to any value from 1 through 254.
FromArgb(byte, RGBValue)
Creates a Color structure from the four ARGB component (alpha, red, green, and blue) values.
public static Color FromArgb(byte alpha, RGBValue rgb)
Parameters
Returns
Remarks
To create an opaque color, set alpha to 255. To create a semitransparent color, set alpha to any value from 1 through 254.
FromArgb(byte, Color)
Creates a Color structure from the specified Color structure, but with the new specified alpha value. Although this method allows a 32-bit value to be passed for the alpha value, the value is limited to 8 bits.
public static Color FromArgb(byte alpha, Color baseColor)
Parameters
alpha
byteThe alpha value for the new Color. Valid values are 0 through 255.
baseColor
ColorThe Color from which to create the new Color.
Returns
Remarks
To create an opaque color, set alpha to 255. To create a semitransparent color, set alpha to any value from 1 through 254.
FromArgb(byte, byte, byte)
Creates a Color structure from the specified 8-bit color values (red, green, and blue). The alpha value is implicitly 255 (fully opaque). Although this method allows a 32-bit value to be passed for each color component, the value of each component is limited to 8 bits.
public static Color FromArgb(byte red, byte green, byte blue)
Parameters
red
byteThe red component value for the new Color. Valid values are 0 through 255.
green
byteThe green component value for the new Color. Valid values are 0 through 255.
blue
byteThe blue component value for the new Color. Valid values are 0 through 255.
Returns
Exceptions
- ArgumentException
red
,green
, orblue
is less than 0 or greater than 255.