Color.FromArgb(Byte, Byte, Byte, Byte) Method

Definition

Creates a new Color structure by using the specified sRGB alpha channel and color channel values.

C#
public static System.Windows.Media.Color FromArgb(byte a, byte r, byte g, byte b);

Parameters

a
Byte

The alpha channel, A, of the new color.

r
Byte

The red channel, R, of the new color.

g
Byte

The green channel, G, of the new color.

b
Byte

The blue channel, B, of the new color.

Returns

A Color structure with the specified values.

Examples

C#
private Color FromArgbExample()
{
    // Create a blue color using the FromArgb static method.
    Color myArgbColor = new Color();
    myArgbColor = Color.FromArgb(255, 0, 255, 0);
    return myArgbColor;
}

Remarks

The FromArgb method allows you to specify the alpha channel; the FromRgb method uses a default value of 255 for the alpha channel.

The alpha channel of a color determines the amount of transparency of the color. An alpha value of 255 indicates that the color is completely opaque, and a value of 0 indicates that the color is completely transparent.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also