Report Margins

Re: Report Margins

Postby Enrico Maria Giordano » Mon Jan 01, 2018 11:31 am

ukoenig wrote:I tested changing the STYLE expecting maybe to show lines dotted
but there are only solid lines, COLOR works

DEFINE PEN oPen[1] STYLE 0 WIDTH 3 COLOR CLR_RED
DEFINE PEN oPen[2] STYLE 1 WIDTH 2 COLOR CLR_BLUE

regards
Uwe :?:


https://msdn.microsoft.com/it-it/library/windows/desktop/dd183509(v=vs.85).aspx

Please note: "This style is valid only when the pen width is one or less in device units."

/* Pen Styles */
#define PS_SOLID 0
#define PS_DASH 1 /* ------- */
#define PS_DOT 2 /* ....... */
#define PS_DASHDOT 3 /* _._._._ */
#define PS_DASHDOTDOT 4 /* _.._.._ */
#define PS_NULL 5
#define PS_INSIDEFRAME 6
#define PS_USERSTYLE 7
#define PS_ALTERNATE 8

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

Re: Report Margins

Postby Otto » Mon Jan 01, 2018 12:20 pm

Hello Silvio,
please try to use EasyReport.

POP is the Keyword.
POP = PRINTAREA on PRINTAREA .

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6353
Joined: Fri Oct 07, 2005 7:07 pm

Re: Report Margins

Postby Silvio.Falconi » Mon Jan 01, 2018 6:30 pm

I'm making label print function and my labels are on 0,0 (x,y) no respect margins. I use oprinter device
I no use ER I use that my app I saw you at sillian

but this afternoon perhaps I found a solution

oPrinter := TPrinter():New( ...... )

nLogPixX := oPrinter:nLogPixelX() / 2.54 ( centimetres)
nLogPixY := oPrinter:nLogPixelY() / 2.54

nLeftMargin := Int( nLogPixX * 0.5 )
nRightMargin := Int( nLogPixX * 0.5 )
nTopMargin := Int( nLogPixY * 0.5 )
nDnMargin := Int( nLogPixY * 0.5 )


now respect top and left margin
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7086
Joined: Thu Oct 18, 2012 7:17 pm

Re: Report Margins

Postby Silvio.Falconi » Mon Jan 01, 2018 11:15 pm

i EXPLAIN YOU

Please compile this test
Code: Select all  Expand view  RUN


#include <fivewin.ch>
#define PAD_LEFT            0
#define PAD_RIGHT           1
#define PAD_CENTER          2

Function Test(lPreview)
LOCAL oPrinter
Local nLogPixX,nLogPixY
Local nLeftMargin,nRightMargin,nTopMargin,nDnMargin
Local nSpaceH,nSpaceV

LOCAL hPen
local x:=0
Local y:=0

DEFAULT lPreview := .T.

 oPrinter := TPrinter():New( "Test margins", .f., lPreview  )

   nLogPixX := oPrinter:nLogPixelX() /  2.54
   nLogPixY := oPrinter:nLogPixelY() / 2.54

   nLeftMargin  := Int( nLogPixX * 0.5 )
   nRightMargin := Int( nLogPixX * 0.5 )
   nTopMargin   := Int( nLogPixY * 0.5 )
   nDnMargin    := Int( nLogPixY * 0.5 )

   nSpaceH      := Int( nLogPixY * 0.5 )
   nSpaceV      := Int( nLogPixY * 0.5 )

   //hPen :=  CreatePen( PS_DOT, 1, CLR_BLUE )
   DEFINE PEN oPen WIDTH  2   OF oPrinter STYLE PS_DOT
   DEFINE FONT oFont NAME "Arial" SIZE 0, -10 BOLD OF oPrinter
   oPrinter:StartPage()

         nLinI := 0.5
         nColI := 0.5
         nLinF := 27.4
         nColF := 20.8

         oPrinter:Cmtr2Pix(@nLinI, @nColI)
         oPrinter:cmtr2Pix(@nLinF, @nColF)
         oPrinter:Box(nLinI, nColI, nLinF, nColF, oPen  )


 oPrinter:EndPage()



if lPreview
      oPrinter:lPrvModal := .T.
      oPrinter:Preview()
   else
      oPrinter:End()
   endif


return ni


Image

on this test I try with these parameters :

nLinI := 0.5 -----> ( 0.0) + topmargin
nColI := 0.5 -----> ( 0.0) +leftmargins
nLinF := 27.4 -----> (27.9 -bottommargins)
nColF := 20.8 -----> (21.3 - rightmargins)


But How I can found these parameters from Device (oPrinter) directly ?


I try with :

nLinI := 0.5
nColI := 0.5
nLinF := oPrinter:nVertSize() / 10 - 0.5
nColF := oPrinter:nHorzSize() / 10 - 0.5

but this is right ???
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7086
Joined: Thu Oct 18, 2012 7:17 pm

Re: Report Margins

Postby Silvio.Falconi » Mon Jan 01, 2018 11:35 pm

Another test :

I set the margins :

nDnMargin := 1.5
nTopMargin := 1.5
nLeftMargin := 0.9
nRightMargin := 2.0


Code: Select all  Expand view  RUN


#include <fivewin.ch>
#define PAD_LEFT            0
#define PAD_RIGHT           1
#define PAD_CENTER          2

Function Test(lPreview)
LOCAL oPrinter
Local nLogPixX,nLogPixY
Local nLeftMargin,nRightMargin,nTopMargin,nDnMargin
Local nSpaceH,nSpaceV

LOCAL hPen


DEFAULT lPreview := .T.

 oPrinter := TPrinter():New( "Test margins", .f., lPreview  )

    nDnMargin       := 1.5
    nTopMargin      := 1.5
    nLeftMargin     := 0.9
    nRightMargin    := 2.0

   //hPen :=  CreatePen( PS_DOT, 1, CLR_BLUE )

   DEFINE PEN oPen WIDTH  2   OF oPrinter STYLE PS_DOT
   DEFINE FONT oFont NAME "Arial" SIZE 0, -10 BOLD OF oPrinter

   oPrinter:StartPage()

         nLinI := 0.5     + nTopMargin
         nColI := 0.5     + nLeftMargin
         nLinF := oPrinter:nVertSize()  / 10  - 0.5 - nDnMargin
         nColF := oPrinter:nHorzSize()  / 10  - 0.5 - nRightMargin

         oPrinter:Cmtr2Pix(@nLinI, @nColI)
         oPrinter:cmtr2Pix(@nLinF, @nColF)
         oPrinter:Box(nLinI, nColI, nLinF, nColF, oPen  )
         oPrinter:EndPage()

   if lPreview
      oPrinter:lPrvModal := .T.
      oPrinter:Preview()
   else
      oPrinter:End()
   endif


return ni
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7086
Joined: Thu Oct 18, 2012 7:17 pm

Re: Report Margins

Postby Enrico Maria Giordano » Tue Jan 02, 2018 9:03 am

That is the right way. As I already said, TPrinter has no margins to set.

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

Re: Report Margins

Postby Silvio.Falconi » Tue Jan 02, 2018 5:24 pm

Enrico Maria Giordano wrote:That is the right way. As I already said, TPrinter has no margins to set.

EMG


i think it can be made directly on tmetafile
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7086
Joined: Thu Oct 18, 2012 7:17 pm

Re: Report Margins

Postby Enrico Maria Giordano » Tue Jan 02, 2018 6:19 pm

Yes, it can be done. Try using

Code: Select all  Expand view  RUN
oMeta:SetOrg(nX,nY)


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

Re: Report Margins

Postby Silvio.Falconi » Tue Jan 02, 2018 11:56 pm

How?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7086
Joined: Thu Oct 18, 2012 7:17 pm

Re: Report Margins

Postby Silvio.Falconi » Wed Jan 03, 2018 10:01 am

Perhaps

New method and data

::nPrnXOffset := oPrev:oDevice:nXOffset
::nPrnYOffset := oPrev:oDevice:nYOffset
::nPageWidth := oPrev:nHorzRes
::nPageHeight := oPrev:nVertRes

Method Margins class Tpreview
LOCAL nleft,ntop,nbottom,nright

nleft :=-::nPrnXOffset
ntop :=-::nPrnYOffset
nRight := ::nPageWidth - ::nPrnXOffset
nBottom := ::nPageHeight- ::nPrnYOffset

Rectangle( ::hDC, -::nPrnYOffset ,-::nPrnXOffset,::nPageHeight- ::nPrnYOffset,;
::nPageWidth - ::nPrnXOffset) , ::open:hpen)

only a test.... I not try
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7086
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 27 guests