Visual Basic uses a consistent system for all color properties and graphics methods. A color is represented by a Long integer, and this value has the same meaning in all contexts that specify a color.
There are four ways to specify a color value at run time:
This section discusses how to use the RGB and QBColor functions as simple ways to specify color. See "Using Color Properties" later in this chapter for information on using constants to define color or directly entering color values.
You can use the RGB function to specify any color.
To use the RGB function to specify a color
Every visible color can be produced by combining one or more of the three primary colors. For example:
' Set background to green.
Form1.BackColor = RGB(0, 128, 0)
' Set background to yellow.
Form2.BackColor = RGB(255, 255, 0)
' Set point to dark blue.
PSet (100, 100), RGB(0, 0, 64)
For More Information For information on the RGB function, see "RGB Function" in the Language Reference.