TPrinter Class Problem : Reverse Mode Printing

TPrinter Class Problem : Reverse Mode Printing

Postby Milan Mehta » Sun Mar 12, 2006 6: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.
Milan Mehta
 
Posts: 115
Joined: Mon Oct 17, 2005 4:42 am
Location: India

Postby Antonio Linares » Sun Mar 12, 2006 7:54 am

Milan,

Please review samples\report\rep22.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42094
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TPrinter Class Problem : Reverse Mode Printing

Postby ORibeiro » 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
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: TPrinter Class Problem : Reverse Mode Printing

Postby nageswaragunupudi » Sat Nov 05, 2016 3:05 am

FWH 16.04 onwards

Code: Select all  Expand view
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


Image
Regards

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

Re: TPrinter Class Problem : Reverse Mode Printing

Postby ORibeiro » 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
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: TPrinter Class Problem : Reverse Mode Printing

Postby ukoenig » Thu Nov 10, 2016 3: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 )

Image

this solution works for me.

best regards
Uwe :D
Last edited by ukoenig on Sat Nov 12, 2016 1:18 pm, edited 11 times in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: TPrinter Class Problem : Reverse Mode Printing

Postby nageswaragunupudi » Thu Nov 10, 2016 4: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: Select all  Expand view
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.
Image
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 105 guests