FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour print color fonts
Posts: 124
Joined: Sat Dec 05, 2009 12:44 PM
print color fonts
Posted: 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é

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: print color fonts
Posted: Wed Aug 29, 2018 12:00 PM

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

EMG

Posts: 107
Joined: Tue Sep 15, 2009 07:52 AM
Re: print color fonts
Posted: Wed Aug 29, 2018 01:20 PM
unless you want to do this afterwards:

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


Emiliano Llano Díaz
Posts: 124
Joined: Sat Dec 05, 2009 12:44 PM
Re: print color fonts
Posted: Wed Aug 29, 2018 02:21 PM

Thank you Ellano, it works !!

Posts: 124
Joined: Sat Dec 05, 2009 12:44 PM
Re: print color fonts
Posted: Wed Aug 29, 2018 03: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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: print color fonts
Posted: Wed Aug 29, 2018 10:07 PM
Code (fw): Select all Collapse
#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


Regards



G. N. Rao.

Hyderabad, India
Posts: 124
Joined: Sat Dec 05, 2009 12:44 PM
Re: print color fonts
Posted: Thu Aug 30, 2018 06:21 AM

Thank you very much to all of you, problem solved !
Kind regards
José

Continue the discussion