Table of Contents

Method FromArgb

Namespace
Alternet.Drawing
Assembly
Alternet.UI.Common.dll

FromArgb(int)

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

public static Color FromArgb(int argb)

Parameters

argb int

A value specifying the 32-bit ARGB value.

Returns

Color

The Color structure that this method creates.

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 byte

The alpha component.

red byte

The red component.

green byte

The green component.

blue byte

The blue component.

Returns

Color

The Color that this method creates.

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 int

The red component. Valid values are 0 through 255.

green int

The green component. Valid values are 0 through 255.

blue int

The blue component. Valid values are 0 through 255.

Returns

Color

The Color that this method creates.

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 int

The alpha component. Valid values are 0 through 255.

red int

The red component. Valid values are 0 through 255.

green int

The green component. Valid values are 0 through 255.

blue int

The blue component. Valid values are 0 through 255.

Returns

Color

The Color that this method creates.

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

alpha byte

The alpha component.

rgb RGBValue

RGB component

Returns

Color

The Color that this method creates.

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 byte

The alpha value for the new Color. Valid values are 0 through 255.

baseColor Color

The Color from which to create the new Color.

Returns

Color

The Color that this method creates.

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 byte

The red component value for the new Color. Valid values are 0 through 255.

green byte

The green component value for the new Color. Valid values are 0 through 255.

blue byte

The blue component value for the new Color. Valid values are 0 through 255.

Returns

Color

The Color that this method creates.

Exceptions

ArgumentException

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