RESOLUTION
To change the background color of all windows under Windows 95 or Windows
NT 4.0, you must change the
Window color on the
Appearance tab of the Display Properties. To change this property, right-click the Windows 95 or Windows NT 4.0 desktop, and then click
Properties. Click the
Appearance tab, click
Window under the
Item drop-down list, and then click
white.
This option may not be desirable because users must keep the window
color white whenever they print in @..SAYs from FoxPro under Windows 95 or
Windows NT 4.0. A better way to implement this is to check the background
color of the window or desktop from the code, the form, or the screen before you issue the @...SAY. To implement this with Microsoft Visual FoxPro 3.0 and Microsoft FoxPro for Windows 2.6., follow these steps:
If the @...SAY code is executed from a program in Visual FoxPro for
Windows, the window color can be changed with the following code:
IF _Screen.BackColor != 16777215 &&Is color value white?
_Screen.LockScreen = .T. &&Keep screen from flashing
cOldbackcolor = _Screen.BackColor &&Save background color
cOldForecolor = _Screen.ForeColor&& Save foreground color
_Screen.ForeColor = Rgb(0,0,0) &&Set ForeColor to RGB Black -
_Screen.BackColor = RGB(255,255,255) &&Set BackColor to RGB white
SET DEVICE TO PRINTER
@1,1 say 'This is a test.'
SET DEVICE TO SCREEN
SET PRINTER TO
_Screen.BackColor = cOldbackcolor
_Screen.ForeColor = cOldForecolor
_Screen.LockScreen = .F.
ENDIF
If the @...SAY code is executed from a form in Visual FoxPro for Windows,
the background color of the form can be modified with the following code:
IF ThisForm.BackColor != 16777215
ThisForm.LockScreen = .T.
SET DEVICE TO PRINTER
cOldbackcolor = ThisForm.BackColor
cOldForecolor = ThisForm.ForeColor
ThisForm.BackColor = RGB(255,255,255)
ThisForm.ForeColor = RGB(0,0,0)
@1,1 SAY 'This is a test'
SET DEVICE TO SCREEN
SET PRINTER TO
ThisForm.BackColor = cOldbackcolor
ThisForm.ForeColor = cOldForecolor
ThisForm.LockScreen = .F.
ENDIF
NOTE: This code may be placed in the
Click event of a
Command button.
In FoxPro for Windows 2.6, use the following code to change the window
color:
cOldscheme = SET('Color of Scheme 1') &&Obtain old color
MODIFY WINDOW SCREEN COLOR RGB(0,0,0,255,255,255) &&Set color white
SET DEVICE TO PRINTER
@1,1 say ' This is a test.'
SET DEVICE TO SCREEN
SET PRINTER TO
MODIFY WINDOW SCREEN COLOR &cOldscheme
NOTE: In FoxPro 2.6a for Windows, issue the following command after the SET DEVICE TO PRINTER command to prevent the gray background:
SET PRINT FONT "some font name", 10