Qbcolor()函数的用法

解决方案 »

  1.   

    QBColor 函数返回一个 Long,用来表示所对应颜色值的 RGB 颜色码。语法QBColor(color)必要的 color 参数是一个界于 0 到 15 的整型。设置值color 参数有以下这些设置:值 颜色 值 颜色 
    0 黑色 8 灰色 
    1 兰色 9 亮兰色 
    2 绿色 10 亮绿色 
    3 青色 11 亮青色 
    4 红色 12 亮红色 
    5 洋红色 13 亮洋红色 
    6 黄色 14 亮黄色 
    7 白色 15 亮白色 
    说明color 参数代表使用于早期版本的 Basic(诸如 Microsoft Visual Basic for MS-DOS 以及 Basic Compiler)的颜色值。始于最低有效字节,返回值指定了红、绿、蓝三原色的值,用于设置成 VBA中RGB 系统的对应颜色。
      

  2.   

    Sub ChangeBackColor (ColorCode As Integer, MyForm As Form)
       MyForm.BackColor = QBColor(ColorCode)
    End Sub====================================================================
    QBColor Function
          Returns a Long representing the RGB color code corresponding to the specified color number.SyntaxQBColor(color)The required color argument is a whole number in the range 0–15.SettingsThe color argument has these settings:Number Color Number Color 
    0 Black 8 Gray 
    1 Blue 9 Light Blue 
    2 Green 10 Light Green 
    3 Cyan 11 Light Cyan 
    4 Red 12 Light Red 
    5 Magenta 13 Light Magenta 
    6 Yellow 14 Light Yellow 
    7 White 15 Bright White 
    ResThe color argument represents color values used by earlier versions of Basic (such as Microsoft Visual Basic for MS-DOS and the Basic Compiler). 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.