FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TPrinter Class Problem : Reverse Mode Printing
Posts: 115
Joined: Mon Oct 17, 2005 04:42 AM
TPrinter Class Problem : Reverse Mode Printing
Posted: Sun Mar 12, 2006 06:25 AM

Hello All,

Is there any way to define background of text ? I want to print certain text in reverse mode : i.e. Black background and white foreground.

Is it possible ?

TIA
Milan.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TPrinter Class Problem : Reverse Mode Printing
Posted: Sun Mar 12, 2006 07:54 AM

Milan,

Please review samples\report\rep22.prg

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: TPrinter Class Problem : Reverse Mode Printing
Posted: Fri Nov 04, 2016 10:12 PM

Is it possible using the PRINT class instead of REPORT class?

Thanks,

Oscar

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TPrinter Class Problem : Reverse Mode Printing
Posted: Sat Nov 05, 2016 03:05 AM
FWH 16.04 onwards

Code (fw): Select all Collapse
function ReversePrint

   local oPrn, oFont

   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "ARIAL" SIZE 0,-30 BOLD OF oPrn

   PAGE
      @ 200,200 PRINT TO oPrn TEXT "This is Reverse Text" FONT oFont ;
         COLOR CLR_WHITE,CLR_BLACK
   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont

return nil


Regards



G. N. Rao.

Hyderabad, India
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: TPrinter Class Problem : Reverse Mode Printing
Posted: Sat Nov 05, 2016 10:42 AM

Thank you Rao,

How can I do this with oPrn:Say() ?

Oscar

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: TPrinter Class Problem : Reverse Mode Printing
Posted: Thu Nov 10, 2016 03:38 PM
Hello Oscar,

it is a bit tricky because I don't use a defined text-background-color.
The black area can be any size and doesn't belong to the textheight and width like a normal text-backgroundcolor.
The width of the black area will be the same size on all pages.
I think it looks much better because of the possible defined space around the text,
but it is a matter of taste.

1. define a hight value for the pensize to get a black area like
DEFINE PEN oPen3 WIDTH 100 OF oPRINT

2. define a BLACK BOX on the textposition like
oPRINT:CmBox( 2.2, 2.8, 2.4, 8.0, oPen3 )
// METHOD CmBox( nRow, nCol, nBottom, nRight, oPen )

3. paint the text on top of the box in WHITE
oPRINT:cmSay( 2.0, 2.8, "Your text", oFont3,,CLR_WHITE,,PAD_LEFT )



this solution works for me.

best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: TPrinter Class Problem : Reverse Mode Printing
Posted: Thu Nov 10, 2016 04:08 PM
ORibeiro wrote:Thank you Rao,

How can I do this with oPrn:Say() ?

Oscar


Sorry for the late reply.

About the caption: There is no problem with the TPrinter Class

Here is the recommended approach:
Code (fw): Select all Collapse
function ReversePrint

   local oPrn, oFont
   local nOldClr

   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "ARIAL" SIZE 0,-30 BOLD OF oPrn

   PAGE
      nOldClr  := SetBkColor( oPrn:hDCOut, CLR_BLACK )
      oPrn:Say( 200, 200, "This is Reverse Text", oFont, 5000, CLR_WHITE, 2 )
      SetBkColor( nOldClr )
   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont

return nil

This shows how to set foreground color and background color.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion