Information.RGB(Int32, Int32, Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳 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的範圍內,代表紅色成分的強度。
- Green
- Int32
必須的。
Integer 在0到255的範圍內,代表綠色成分的強度。
- Blue
- Int32
必須的。
Integer 在0-255的範圍內,代表藍色成分的強度。
傳回
回傳 Integer 一個代表紅色、綠色和藍色成分的RGB色彩值的值。
例外狀況
Green
Blue
Red,或超出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 |