WPF: Color.FromArgb(Byte, Byte, Byte, Byte) Usage

Color.FromArgb(Byte, Byte, Byte, Byte) method
reference

Definitions
Namespace:
System.Windows.Media
Assembly:
PresentationCore.dll
Creates a new Color structure with the specified sRGB Alpha channel and color channel values.

C#

Copy
public static System.Windows.Media.Color FromArgb (byte a, byte r, byte g, byte b);
parameter
a
Byte
Alpha channel A of the new color.

r
Byte
the red channel R of the new color.

g
Byte
Green channel G of the new color.

b
Byte
blue channel B of the new color.

Returns a
Color
structure with the specified value.

Example
C#

Copy
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; } Annotate the method FromArgb Allows specifying an alpha channel; the method FromRgb uses a default of 255 for the alpha channel.






The alpha channel of a color determines the transparency of the color. An alpha value of 255 means the color is completely opaque, and a value of 0 means 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
Windows Desktop 3.0, 3.1, 5, 6, 7

Guess you like

Origin blog.csdn.net/weixin_41883890/article/details/128803409