QBColor Function

See Also3UW5F4P              Example56JI09R>Low

Returns the RGB color code corresponding to a color number.

Syntax

QBColor (qbcolor)

Remarks

The qbcolor argument is an integer in the range 0-15, inclusive, that corresponds to the color values used by other versions of Basic (such as Microsoft Visual Basic for MS-DOS and 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.

The following table shows the possible settings for qbcolor:

NumberColor

NumberColor

 

 

0Black

Gray

1Blue

Light Blue

2Green

Light Green

3Cyan

Light Cyan

4Red

Light Red

5Magenta

Light Magenta

6Yellow

Light Yellow

7White

Bright White

 


See Also

 RGB FunctionLANRGB


QBColor Function Example

The example uses the QBColor function to show the range of colors on a form. To try this example, paste the code into the Declarations section of a form.  Then press F5 and click the form.

 

Sub Form_Click ()

   Dim I                                 ' Declare variable

   Cls                                   ' Clear form.

   ScaleHeight = 16                      ' Divide form into 16 parts.

   For I = 0 To 15                       ' Draw a colored box.

      Line(0, I)-(ScaleWidth, I + 1), QBColor(I), BF

   Next I

End Sub