Information.RGB(Int32, Int32, Int32) 方法

定义

返回一个 Integer 值,该值表示一组红色、绿色和蓝色组件中的 RGB 颜色值。

public:
 static int RGB(int Red, int Green, int Blue);
public static int RGB(int Red, int Green, int Blue);
static member RGB : int * int * int -> int
Public Function RGB (Red As Integer, Green As Integer, Blue As Integer) As Integer

参数

Red
Int32

必填。 Integer 范围 0-255(含)表示颜色红色分量强度的 0-255。

Green
Int32

必填。 Integer 范围 0-255(含)表示颜色绿色分量强度的 0-255。

Blue
Int32

必填。 Integer 范围 0-255(含)表示颜色蓝色分量强度的 0-255。

返回

返回一个 Integer 值,该值表示一组红色、绿色和蓝色组件中的 RGB 颜色值。

例外

GreenBlueRed 超出范围 0 到 255(含)。

示例

此示例演示如何 RGB 使用该函数返回表示 RGB 颜色值的整数。

Dim red, rgbValue As Integer
Dim i As Integer = 75
' Return the value for red.
red = RGB(255, 0, 0)
' Same as RGB(75, 139, 203).
rgbValue = RGB(i, 64 + i, 128 + i)

注解

接受颜色规范的应用程序方法和属性要求该规范是表示 RGB 颜色值的数字。 RGB 颜色值指定红色、绿色和蓝色的相对强度,以便显示特定颜色。

如果任一参数 RGB 的值大于 255,则使用 255。

下表列出了一些标准颜色和它们包括的红色、绿色和蓝色值。

颜色 红值 绿值 蓝值
黑色 0 0 0
蓝色 0 0 255
绿色 0 255 0
青色 0 255 255
红色 255 0 0
品红 255 0 255
黄色 255 255 0
白色 255 255 255

适用于

另请参阅