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.
oObject.BackColor = nColor
nColor = oObject.BackColor
oObject.ForeColor = nColor
nColor = oObject.ForeColornColor is a color number in the range 0 to 16777215. Since we don't have all 16 million colors at our fingertips, we generally use the predefined colors in FoxPro.H, RGB() (if we know the right red-green-blue trio) or GETCOLOR() to set these properties.
Changes to BackColor and ForeColor take place right away. However, text and graphics that have been drawn on a form (either through traditional Xbase commands like ?, DISPLAY, and so forth, or through the form's graphic methods like Line and Circle) don't change color when the form's ForeColor changes. You have to redraw them to change their color.
If a control's BackStyle is Transparent, its BackColor is ignored and the form's BackColor or an underlying object shows instead.
|
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. |
While these properties let you control form and object colors, we strongly advise you not to do so. If you just leave well enough alone, your forms will adopt the user's chosen Windows colors (the ones picked in the Display Properties applet). Almost all the time, that's your best choice.
* 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.BackStyle, ColorScheme, ColorSource, DisabledBackColor, DisabledForeColor, FillColor, FillStyle, GetColor(), #Include, RGB(), SelectedBackColor, SelectedForeColor

