Information.RGB 方法
傳回 Integer 值,表示一組紅色、綠色和藍色元件中的 RGB 色彩值。
命名空間: Microsoft.VisualBasic
組件: Microsoft.VisualBasic (在 microsoft.visualbasic.dll 中)
語法
'宣告
Public Shared Function RGB ( _
Red As Integer, _
Green As Integer, _
Blue As Integer _
) As Integer
'用途
Dim Red As Integer
Dim Green As Integer
Dim Blue As Integer
Dim returnValue As Integer
returnValue = Information.RGB(Red, Green, Blue)
public static int RGB (
int Red,
int Green,
int Blue
)
public:
static int RGB (
int Red,
int Green,
int Blue
)
public static int RGB (
int Red,
int Green,
int Blue
)
public static function RGB (
Red : int,
Green : int,
Blue : int
) : int
參數
- Red
必要項。在 0–255 範圍 (包含頭尾) 中的 Integer,表示色彩中紅色元件的濃度。
- Green
必要項。在 0–255 範圍 (包含頭尾) 中的 Integer,表示色彩中綠色元件的濃度。
- Blue
必要項。在 0–255 範圍 (包含頭尾) 中的 Integer,表示色彩中藍色元件的濃度。
傳回值
傳回 Integer 值,表示一組紅色、綠色和藍色元件中的 RGB 色彩值。
備註
如需詳細資訊,請參閱 Visual Basic 的主題 RGB 函式 (Visual Basic)。
可接受某個色彩規格的應用程式方法和屬性,會預期這個規格是表示 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 |
範例
此範例將示範如何使用 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)
平台
Windows 98、 Windows 2000 SP4、 Windows CE、 Windows Millennium Edition、 Windows Mobile for Pocket PC、 Windows Mobile for Smartphone、 Windows Server 2003、 Windows XP Media Center Edition、 Windows XP Professional x64 Edition、 Windows XP SP2、 Windows XP Starter Edition
.NET Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱系統需求一節的內容。
版本資訊
.NET Framework
支援版本:2.0、1.1、1.0
.NET Compact Framework
支援版本:2.0、1.0
請參閱
參考
Information 類別
Information 成員
Microsoft.VisualBasic 命名空間
ArgumentException Class