共用方式為


QBColor 函式

更新:2007 年 11 月

傳回代表 RGB 色彩代碼 (對應於指定的色彩編號) 的 Integer 值。

QBColor(Color)

參數

  • Color
    必要項。介於 0–15 範圍之間的整數。

設定

Color 引數具有下列設定。

Number

色彩

Number

色彩

0

黑色

8

灰色

1

藍色

9

淺藍色

2

綠色

10

淺綠色

3

青色

11

淡青色

4

紅色

12

淡紅色

5

洋紅色

13

淺洋紅色

6

黃色

14

淺黃色

7

白色

15

亮白色

例外狀況

例外狀況類型

錯誤代碼

條件

ArgumentException

5

Color 超出 0 到 15 的範圍 (含 0 和 15)。

如果將使用非結構化錯誤處理的 Visual Basic 6.0 應用程式升級,請參閱「錯誤代碼」資料行 (您可以將錯誤代碼與 Number 屬性 (Err 物件) 比對)。但是,請盡可能考慮以 Visual Basic 的結構化例外處理概觀 取代這類錯誤控制項。

備註

從最小顯著性位元組 (Least Significant Byte) 開始,傳回的值可指定用來在 RGB 系統中設定 Visual Basic 語言所用適當色彩的紅色、綠色和藍色等值。

範例

這個範例會使用 QBColor 函式來變更成 colorInteger 所指出的色彩。QBColor 會接受 0 與 15 間的整數值。

Dim colorInteger As Integer
' Use 4 for red.
colorInteger = QBColor(4)

需求

命名空間 (Namespace)︰Microsoft.VisualBasic

**模組︰**Information

組件:Visual Basic Runtime Library (在 Microsoft.VisualBasic.dll 中)

請參閱

參考

RGB 函式 (Visual Basic)

ArgumentException