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

必要。 在 0-255 範圍 (包含頭尾) 中的 Integer,表示色彩中紅色元件的濃度。

Green
Int32

必要。 在 0-255 範圍 (包含頭尾) 中的 Integer,表示色彩中綠色元件的濃度。

Blue
Int32

必要。 在 0-255 範圍 (包含頭尾) 中的 Integer,表示色彩中藍色元件的濃度。

傳回

傳回 Integer 值,表示一組紅色、綠色和藍色元件中的 RGB 色彩值。

例外狀況

GreenBlueRed 超出 0 到 225 的範圍 (含 0 和 225)。

範例

此範例示範如何使用 函 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
11:青色 0 255 255
紅色 255 0 0
桃紅色 255 0 255
黃色 255 255 0
白色 255 255 255

適用於

另請參閱