BackColor Property
Object List Next Object
Defined By: Window
Description:
Determines the background color of an object to be the system default color or
a different color using the color palette, the RGB function, or QBColor
function in code.
Settings:
Phoenix uses the RGB color scheme provided with the MS Windows environment.
The optional =color argument can be specified using one of the following:
the RGB functions in code
the QBColor functions in code
a long integer constant, (hexadecimal recommended)
Details:
The default background color for forms and controls is selected using the
Control Panel supplied with the Window's environment. A value of -1 for BackColor
indicates the form or control will display the system default color. You can
override this default by setting the BackColor property to a value other than -1.
You can begin each BackColor expression by naming the specific form or control
whose background you want to change. If you omit the form or control name,
Phoenix will change the background color of the current form or control.
Caution: If you enter a value for the BackColor property on Form or PictureBox
objects, it erases all graphics and print output, including the persistent bitmap.
The easiest way to understand how a long constant is converted to color is to
consider the hexadecimal format of the constant, e.g. &HFFFFFF. Only the
least-significant three bytes are important, with each byte specifying the intensity
of one of the red, green, or blue components of the color. The least
significant byte is the red component, the next byte (second from the right) is the green
component, and the next (third from the right) is the blue component. This is
the same as saying &H0000FF is bright red, &H00FF00 is bright green, and
&HFF0000 is bright blue. The most significant byte should generally be zero, except
when specifying -1 (&HFFFFFFFF) to indicate the form or control should use the
default color.
To get a hexadecimal value for any of the 16 colors standard in Windows, you
can use the QBColor function. The QBColor function requires you to specify the
integer color number used in versions of Microsoft BASIC.
The RGB function, like QBColor, returns a hexadecimal value for colors. The
color specified by an RGB function, however, is the result of combining a
specified intensity of red, green, and blue. The value for the red, green, and blue
arguments ranges from 0 to 255 (&HFF). The RGB function combines the given values
of the components as described previously to return a long integer value that
represents the color.
Be sure to set the background color to solid when displaying text in the
Window's environment. If the background colors you specified are not displayed as
expected, one of the selected colors may be dithered (comprised of up to three
different colored pixels). If you select a dithered color for the background, the
system substitutes the nearest solid color.
Select your colors carefully. Always consider the foreground color as well as
the background when changing and selecting colors. Selecting certain color
combinations can call attention to a designated form or control, or it can actually
make your interface harder to see or distracting to look at. Specifying a
background color that contrasts with the foreground color allows you to make
certain forms or controls more visible. Basic colors such as white and gray are
commonly used when good contrast is needed.
Data Type: Long
See Also:
FillColor property, FillStyle property