BackColor, ForeColor
These properties control the color of objects. Big surprise. BackColor is the background (or "paper") color, while ForeColor is the foreground (or "ink") color. For some objects, one or the other is irrelevant. For example, CommandButtons don't have a BackColor, while CommandGroups don't have a ForeColor.
Usage |
oObject.BackColor = nColor nColor = oObject.BackColor oObject.ForeColor = nColor nColor = oObject.ForeColor |
Well, almost. In VFP 5 and later, when a text box or edit box with BackStyle set to Transparent gets focus, the control's BackColor shows anyway. |
Be aware that the actual colors you see are affected by factors like video card and resolution. For example, under some circumstances, with certain choices for a form's (or _SCREEN's) BackColor, we see some weird effects with text drawn to the form. Rather than being transparent, there's a box of another color around the text. To see if this is an issue for you, try setting your display to 256 colors, set _SCREEN.BackColor to Magenta (8388863) and then issue DISPLAY MEMORY. We see purple boxes around the DISP MEMO information. |
Example |
* You could let the user set a form's colors by putting * a couple of buttons on the form. The Click code for the * "Background Color" button might be: ThisForm.BackColor = GETCOLOR() * The "Foreground Color" button would have similar code. * Note that we don't really recommend this approach. |
See Also |
BackStyle, ColorScheme, ColorSource, DisabledBackColor, DisabledForeColor, FillColor, FillStyle, GetColor(), #Include, RGB(), SelectedBackColor, SelectedForeColor |