ForeColor Property
Object List Next Object
Defined By: Window
Description:
Determines the foreground 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 MS Windows environment RGB scheme for colors. 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 foreground color for forms and controls is the selected using the
Control Panel supplied with the Window's environment. A value of -1 for
ForeColor indicates the form or control will display the system default color. You can
override this default by setting the ForeColor property to a value other than
-1.
You can begin each ForeColor expression by naming the specific form or control
whose foreground you want to change. If you omit the form or control name, the
system will change the foreground color of the current form or control.
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 above to return a long integer value that
represents the color.
Be sure to set the foreground color to solid when displaying text. If the
foreground 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 foreground, Phoenix automatically
substitutes the nearest solid color.
Select your colors carefully. Always consider both the foreground and
background color when changing and selecting colors.
The ForeColor property is useful for setting a color that calls attention to a
designated form or control. For example, red or orange text is highly visible
on a gray background and would quickly alert a user to information that was
vital to their interaction with the program. Selecting certain color combinations
or overusing colors such as red or orange can actually make your interface more
difficult to see and use.
Data Type: Long
See Also:
FillColor property, FillStyle property