Article ID: 154170
Article Last Modified on 5/12/2003
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.
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
SET DEVICE TO PRINTER
FOR i = 1 TO 2 &&Loop shows different output from VFP &FPW26
@1,1 SAY 'This is a printing test' FONT 'Arial',14
@3,1 SAY 'From '+VERSION() + ' under ' + OS(1) FONT 'Courier New'
ENDFOR
SET DEVICE TO SCREEN
SET PRINTER TO
NOTE: This code can be executed in a FoxPro for Windows 2.6 screen,
and in a Visual FoxPro for Windows 3.0 form.Additional query words: kbvfp300 kbvfp500 kbvfp600
Keywords: kbbug kbprint kbprb KB154170