Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem-Screen color attributes change print colors
Message
De
16/08/2002 16:45:34
 
 
À
16/08/2002 16:13:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00690511
Message ID:
00690548
Vues:
29
This message has been marked as the solution to the initial question of the thread.
The KB was helpful, but not a complete solution. What does work is to set both the backcolor and the forecolor and then set both back. Wonder why the KB didn't include that? Anyway, I'm posting the solution for lurkers. Thanks so much Jim! You're terrific! (By the way, I forgot to mention that your quick reply is SO APPRECIATED. I could not leave today until I had a resolution for this! It would have been a LONG night!)

Tracy

SOLUTION:
If _Screen.BackColor != 16777215    &&Is color value white?
	_Screen.LockScreen = .T.         &&Keep screen from flashing
	cOldbackcolor = _Screen.BackColor      &&Save background color
	_Screen.BackColor = Rgb(255,255,255)   &&Set BackColor to RGB white
	cOldForeColor = _Screen.ForeColor	&& Save foreground color
	_Screen.ForeColor = Rgb(0,0,0)	&& Set ForeColor to RGB Black -
	Set Device To Printer
	@10,1 Say 'This is a test.'
	Set Device To Screen
	Set Printer To
	_Screen.BackColor = cOldbackcolor
	_Screen.ForeColor = cOldForeColor
	_Screen.LockScreen = .F.
Endif
>Tracy,
>
>Does MS KB #Q154170 relate?
>
>good luck
>
>>We have a FPD26 app that has been partially converted to VFP7. Some of the screens are still the original FPD26 screens being run as the .sprs. In the original app (FPD26) we allowed the users to change the foxpro screens colors. This has never been a problem til now. Since some of the screens are still dos screens, when the user changes the screen colors, the printing no longer works. Sometimes it prints out as solid black boxes and sometimes it prints out as the actual screen color (if using a color printer) like GB+/R for instance will printout as GB+/R on a color printer. However, only the screen attributes have been changed, so why does the printer font change? Please see my code below to duplicate this problem. I can duplicate it over and over but cannot figure a way of resolving it. It is different depending on the printer of course but some of our users have Okidata Microline 320s and some have HP4000, and some have Lexmarks, etc.
>>
>>TIA!!!!!!!!!!!
>>TRACY
>>
>>
>>
>>*SETCOLOR.PRG
>>
>>set COLOR OF SCHEME 1 to W+/G, W+/BG, GR+/B, GR+/B, R+/B, W+/GR, GR+/RB, N+/N, GR+/B, R+/B
>>set COLOR OF SCHEME 2 to W+/n, W+/BG, GR+/B, GR+/B, R+/B, W+/GR, GR+/RB, N+/N, GR+/B, R+/B
>>set COLOR OF SCHEME 3 to W+/B, W+/BG, GR+/B, GR+/B, R+/B, W+/GR, GR+/RB, N+/N, GR+/B, R+/B
>>
>>* DO SETSCHEME
>>
>>DO setscreen1
>>? "THESE ARE THE NEW COLORS"
>>*Test printing
>>set PRINTER TO NAME GETPRINTER()
>>set DEVICE TO printer
>>@1,10 SAY "TEST 1"
>>@5,10 say "This is the first line of text"
>>@8,10 say "This is the 2nd line of text"
>>set PRINTER to
>>set DEVICE TO screen
>>
>>WAIT WINDOW "Press anykey for test 2"
>>*Test with set printer font
>>DO setscreen2
>>set DEVICE TO printer
>>SET PRINTER FONT 'TIMES NEW ROMAN',10
>>@1,10 SAY "TEST 2"
>>@5,10 say "This is the first line of text"
>>@8,10 say "This is the 2nd line of text"
>>set PRINTER to
>>set DEVICE TO screen
>>
>>RETURN
>>
>>****************************************************************
>>PROCEDURE setscreen1
>>#IF 'VISUAL' $ UPPER(VERSION())
>>		
>>	sRGB = RGBSCHEME(1,1)
>>	sRGB = STRTRAN(sRGB, 'RGB(', '')
>>	sRGB = STRTRAN(sRGB, ')', '')
>>		
>>	nRed = VAL(SUBSTR(sRGB, 1, AT(',', sRGB, 1)-1))
>>	nGreen = VAL(SUBSTR(sRGB, AT(',', sRGB, 1)+1, AT(',', sRGB, 2)-1))
>>	nBlue = VAL(SUBSTR(sRGB, AT(',', sRGB, 2)+1, AT(',', sRGB, 3)-1))
>>		
>>	_SCREEN.ForeColor = RGB(nRed, nGreen, nBlue)
>>
>>	nRed = VAL(SUBSTR(sRGB, AT(',', sRGB, 3)+1, AT(',', sRGB, 4)-1))
>>	nGreen = VAL(SUBSTR(sRGB, AT(',', sRGB, 4)+1, AT(',', sRGB, 5)-1))
>>	nBlue = VAL(SUBSTR(sRGB, AT(',', sRGB, 5)+1))
>>
>>	_SCREEN.BackColor = RGB(nRed, nGreen, nBlue)
>>	_SCREEN.FillColor = RGB(nRed, nGreen, nBlue)
>>	
>>#ENDIF
>>CLEAR
>>RETURN
>>
>>****************************************************************
>>PROCEDURE setschem
>>PRIVATE dbfarea,crntreso,newscheme
>>
>>dbfarea = ALIAS()
>>crntreso = SYS(2005)
>>
>>SELECT 0
>>USE (crntreso) ALIAS "TEMPRESO"
>>
>>LOCATE FOR id = "SCRN_BORDER"
>>IF FOUND()
>>	m.borderfill = DATA
>>ENDIF
>>
>>USE IN TEMPRESO
>>IF !EMPTY(dbfarea)
>>	SELECT (dbfarea)
>>ENDIF
>>
>>*---Define Color Atributes for Policy Profiler.
>>screenatr = SCHEME(1,1)
>>inputsatr = SCHEME(1,2)
>>statusatr = SCHEME(1,4)
>>revcolor  = rev_vid(inputsatr)
>>
>>?"SCREEN ATTRIBUTES:"
>>?screenatr
>>?inputsatr
>>?statusatr
>>?revcolor
>>
>>RETURN
>>
>>****************************************************************
>>FUNCTION rev_vid
>>PARAMETER TEXT
>>RETURN SUBSTR(TEXT,AT(",",TEXT)+1)
>>RETURN
>>
>>****************************************************************
>>PROCEDURE setscreen2
>>#IF 'VISUAL' $ UPPER(VERSION())
>>		
>>	sRGB = RGBSCHEME(2,1)
>>	sRGB = STRTRAN(sRGB, 'RGB(', '')
>>	sRGB = STRTRAN(sRGB, ')', '')
>>		
>>	nRed = VAL(SUBSTR(sRGB, 1, AT(',', sRGB, 1)-1))
>>	nGreen = VAL(SUBSTR(sRGB, AT(',', sRGB, 1)+1, AT(',', sRGB, 2)-1))
>>	nBlue = VAL(SUBSTR(sRGB, AT(',', sRGB, 2)+1, AT(',', sRGB, 3)-1))
>>		
>>	_SCREEN.ForeColor = RGB(nRed, nGreen, nBlue)
>>
>>	nRed = VAL(SUBSTR(sRGB, AT(',', sRGB, 3)+1, AT(',', sRGB, 4)-1))
>>	nGreen = VAL(SUBSTR(sRGB, AT(',', sRGB, 4)+1, AT(',', sRGB, 5)-1))
>>	nBlue = VAL(SUBSTR(sRGB, AT(',', sRGB, 5)+1))
>>
>>	_SCREEN.BackColor = RGB(nRed, nGreen, nBlue)
>>	_SCREEN.FillColor = RGB(nRed, nGreen, nBlue)
>>	
>>#ENDIF
>>CLEAR
>>RETURN
>>
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform