print color fonts

print color fonts

Postby jds » Wed Aug 29, 2018 10:53 am

How can I, for example, in the following definition, incorporate the Color of a font (f.e. CLR_RED,...)
>DEFINE FONT oFont NAME 'ARIAL NARROW' SIZE 0,-9 OF oPrn
Thanks
José
jds
 
Posts: 119
Joined: Sat Dec 05, 2009 12:44 pm

Re: print color fonts

Postby Enrico Maria Giordano » Wed Aug 29, 2018 12:00 pm

You can't. You have to use a PEN.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8518
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: print color fonts

Postby ellano » Wed Aug 29, 2018 1:20 pm

unless you want to do this afterwards:

Code: Select all  Expand view
oReport:SAY(line, 5*nColumn,ALLTRIM(MyDB->MyField), oFont, ,CLR_HGREEN)


Emiliano Llano Díaz
ellano
 
Posts: 107
Joined: Tue Sep 15, 2009 7:52 am

Re: print color fonts

Postby jds » Wed Aug 29, 2018 2:21 pm

Thank you Ellano, it works !!
jds
 
Posts: 119
Joined: Sat Dec 05, 2009 12:44 pm

Re: print color fonts

Postby jds » Wed Aug 29, 2018 3:40 pm

Dear Ellano,
With your solution I can print fonts in any color but once I utilize a color font (for example in a do while not eof() ) the rest of records are printed in this color even if I program a condition (if else endif) to print some records of the do while in black color ?

Can you explain me what to do?

Thanks
jds
 
Posts: 119
Joined: Sat Dec 05, 2009 12:44 pm

Re: print color fonts

Postby nageswaragunupudi » Wed Aug 29, 2018 10:07 pm

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oPrn, oFont, nRow
   local aColors := { CLR_HRED, CLR_GREEN, CLR_BLACK }

   USE STATES

   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-20 BOLD OF oPrn
   PAGE

   nRow  := 2

   do while RECNO() <= 20 .and. !eof()

      @ nRow, 1 PRINT TO oPrn TEXT FIELD->NAME SIZE 5 INCHES ;
         FONT oFont COLOR aColors[ ( RECNO() % 3 ) + 1 ] ;
         LASTROW nRow

      SKIP
   enddo

   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont

   CLOSE STATES

return nil


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10468
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: print color fonts

Postby jds » Thu Aug 30, 2018 6:21 am

Thank you very much to all of you, problem solved !
Kind regards
José
jds
 
Posts: 119
Joined: Sat Dec 05, 2009 12:44 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 31 guests