ColorHelper.FromArgb(Byte, Byte, Byte, Byte) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
static Color FromArgb(byte a, byte r, byte g, byte b);
static Color FromArgb(byte const& a, byte const& r, byte const& g, byte const& b);
public static Color FromArgb(byte a, byte r, byte g, byte b);
function fromArgb(a, r, g, b)
Public Shared Function FromArgb (a As Byte, r As Byte, g As Byte, b As Byte) As Color
- a
-
Byte
byte
The A (transparency) component of the desired color. Range is 0-255.
- r
-
Byte
byte
The R component of the desired color. Range is 0-255.
- g
-
Byte
byte
The G component of the desired color. Range is 0-255.
- b
-
Byte
byte
The B component of the desired color. Range is 0-255.
The generated Color value.
This example shows how to create a Color.
Windows::UI::Color orangeColor{ Windows::UI::ColorHelper::FromArgb(255, 255, 128, 0) };
auto orangeColor = Windows::UI::ColorHelper::FromArgb(255, 255, 128, 0);
This example shows how to create a SolidColorBrush with the specified Color.
Windows::UI::Xaml::Media::SolidColorBrush greenBrush{
Windows::UI::ColorHelper::FromArgb(255, 90, 200, 90) };
auto greenBrush = ref new SolidColorBrush(Windows::UI::ColorHelper::FromArgb(255, 90, 200, 90));
C#/Visual Basic The ColorHelper class is available for use from C# and Visual Basic code but it's not commonly used. The FromArgb method that's available as a static method of the Color structure has exactly the same functionality, and you also have other API there that's more convenient to use from Color itself rather than using the ColorHelper class. ColorHelper is mainly intended for C++ code, which doesn't have access to the nondata API of the Color structure.
The most common reason for creating a Color value is to use it as an argument for the SolidColorBrush constructor, then assign that brush to a XAML UI property.
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |