Color.FromArgb

FromArgb(int)

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

public static Color FromArgb(int argb)
ParameterTypeDescription
argbInt32A value specifying the 32-bit ARGB value.

Return Value

The Color structure that this method creates.

See Also


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)
ParameterTypeDescription
alphaInt32The alpha component. Valid values are 0 through 255.
redInt32The red component. Valid values are 0 through 255.
greenInt32The green component. Valid values are 0 through 255.
blueInt32The blue component. Valid values are 0 through 255.

Return Value

The Color that this method creates.

Exceptions

exceptioncondition
ArgumentExceptionalpha, red, green, or blue is less than 0 or greater than 255.

See Also


FromArgb(int, 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(int alpha, Color baseColor)
ParameterTypeDescription
alphaInt32The alpha value for the new Color. Valid values are 0 through 255.
baseColorColorThe Color from which to create the new Color.

Return Value

The Color that this method creates.

Exceptions

exceptioncondition
ArgumentExceptionalpha is less than 0 or greater than 255.

See Also


FromArgb(int, int, int)

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(int red, int green, int blue)
ParameterTypeDescription
redInt32The red component value for the new Color. Valid values are 0 through 255.
greenInt32The green component value for the new Color. Valid values are 0 through 255.
blueInt32The blue component value for the new Color. Valid values are 0 through 255.

Return Value

The Color that this method creates.

Exceptions

exceptioncondition
ArgumentExceptionred, green, or blue is less than 0 or greater than 255.

See Also