Color.FromRgb(Byte, Byte, Byte) Метод
Определение
public:
static System::Windows::Media::Color FromRgb(System::Byte r, System::Byte g, System::Byte b);
public static System.Windows.Media.Color FromRgb (byte r, byte g, byte b);
static member FromRgb : byte * byte * byte -> System.Windows.Media.Color
Public Shared Function FromRgb (r As Byte, g As Byte, b As Byte) As Color
Параметры
Возвраты
Структура Color с заданными значениями и значением альфа-канала, равным 255.A Color structure with the specified values and an alpha channel value of 255.
Примеры
В следующем примере показано, как использовать FromRgb метод для Color создания структуры.The following example shows how to use the FromRgb method to create a Color structure.
private Color FromRgbExample()
{
// Create a green color using the FromRgb static method.
Color myRgbColor = new Color();
myRgbColor = Color.FromRgb(0, 255, 0);
return myRgbColor;
}
Private Function FromRgbExample() As Color
' Create a green color using the FromRgb static method.
Dim myRgbColor As New Color()
myRgbColor = Color.FromRgb(0, 255, 0)
Return myRgbColor
End Function
Комментарии
Метод позволяет указать альфа-канал FromRgb ; метод использует значение по умолчанию 1 для альфа-канала. FromArgbThe FromArgb method allows you to specify the alpha channel; the FromRgb method uses a default value of 1 for the alpha channel.
Альфа-канал цвета определяет степень прозрачности цвета.The alpha channel of a color determines the amount of transparency of the color. Альфа-значение 1 указывает, что цвет является полностью непрозрачным, а значение 0 означает, что цвет полностью прозрачен.An alpha value of 1 indicates that the color is completely opaque, and a value of 0 indicates that the color is completely transparent.
КаналыAsRGB (ScA ScR ,Color ,, )иScBканалы ScGScRGB (,,,) структуры являются синхронизированными свойствами. B G RThe sRGB channels (A, R, G, B) and the ScRGB channels (ScA, ScR, ScG, ScB) of the Color structure are synchronized properties. Например, при Rизменении канала Red цвета sRGB красный ScRканал цветового ScRGB преобразуется в эквивалентное значение.For example, when R, the sRGB red channel, is modified the ScRGB red channel, ScR, is transformed to the equivalent value.