Method FromArgb
FromArgb(int)
Creates a Color structure from a 32-bit ARGB value.
public static Color FromArgb(int argb)
Parameters
argbintA 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
alphabyteThe alpha component.
redbyteThe red component.
greenbyteThe green component.
bluebyteThe 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
redintThe red component. Valid values are 0 through 255.
greenintThe green component. Valid values are 0 through 255.
blueintThe 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
alphaintThe alpha component. Valid values are 0 through 255.
redintThe red component. Valid values are 0 through 255.
greenintThe green component. Valid values are 0 through 255.
blueintThe 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
alphabyteThe alpha value for the new Color. Valid values are 0 through 255.
baseColorColorThe 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
redbyteThe red component value for the new Color. Valid values are 0 through 255.
greenbyteThe green component value for the new Color. Valid values are 0 through 255.
bluebyteThe blue component value for the new Color. Valid values are 0 through 255.
Returns
Exceptions
- ArgumentException
red,green, orblueis less than 0 or greater than 255.