QBColor 函数QBColor function

Returns a Long representing the RGB color code corresponding to the specified color number.Returns a Long representing the RGB color code corresponding to the specified color number.

语法Syntax

QBColor(彩色)QBColor(color)

必需的_color_ 参数是范围0-15 中的整数。The required color argument is a whole number in the range 0-15.

设置Settings

_颜色_参数具有以下设置:The color argument has these settings:

数字Number 颜色Color 数字Number 颜色Color
00 黑色Black utf-88 灰色Gray
11 蓝色Blue 9 浅蓝色Light Blue
双面2 绿色Green 10 10 浅绿色Light Green
第三章3 蓝绿Cyan 11x1711 浅青色Light Cyan
44 红色Red 1212 浅红色Light Red
55 洋红Magenta 1313 浅洋红色Light Magenta
6 黄色Yellow 14 浅黄色Light Yellow
7 白色White 15 亮白色Bright White

备注Remarks

_颜色_参数表示 MS-DOS 的 Microsoft Visual Basic 以及 Basic 编译器等早期版本的 Basic 所使用的颜色值。The color argument represents color values used by earlier versions of Basic (such as Microsoft Visual Basic for MS-DOS and the Basic Compiler). 从最没有意义的字节开始,返回的值指定了红色、绿色和蓝色值,它们可用于在针对应用程序的 Visual Basic 所使用的 RGB 系统中设置相应的值。Starting with the least-significant byte, the returned value specifies the red, green, and blue values used to set the appropriate color in the RGB system used by Visual Basic for Applications.

示例Example

本示例使用QBColor函数更改作为MyForm所示的颜色传入的窗体的ColorCode背景色 属性。This example uses the QBColor function to change the BackColor property of the form passed in as MyForm to the color indicated by ColorCode. QBColor accepts integer values between 0 and 15.QBColor accepts integer values between 0 and 15.

Sub ChangeBackColor (ColorCode As Integer, MyForm As Form)
    MyForm.BackColor = QBColor(ColorCode)
End Sub

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.