Rpreview Margin

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Rpreview Margin

Post by Silvio »

How I can show a Dotted Lines into Rpreview Class to show the Margins of the paper ?

I made a method but it not run ok



I add this data
DATA nMargTop,nMargLeft,nMargBottom,nMargRight AS NUMERIC INIT 0
DATA lMargin, hSolidPen

and on the New method
::hSolidPen := CreatePen (PS_DOT, 1, CLR_GRAY)
::nMargTop := 15
::nMargLeft := 15
::nMargBottom := 15
::nMargRight := 15
::lMargin = .T.

and I add a new method

Code: Select all

 METHOD SMargin() CLASS Tpaper
     if !::lMargin
        return nil
     endif
     ::oWnd:GetDC()
     MoveTo( ::oWnd:hDC              ,;
          ::nMargTop   ,;
          ::nMargLeft )
     LineTo( ::oWnd:hDC              ,;
          ::nMargTop                ,;
          ::nMargLeft             ,;
           ::hSolidPen:hPen )
     MoveTo( ::oWnd:hDC              ,;
        ::nMargTop              ,;
        ::nMargRight )
     LineTo( ::oWnd:hDC              ,;
           ::nMargRight               ,;
           ::nMargBottom             ,;
           ::hSolidPen:hPen )
     ::oWnd:ReleaseDC()
return nil

and I add ::Smargin() on the PaintMeta method



Some can help me please ?
Best Regards, Saludos

Falconi Silvio
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Falconi,

>I made a method but it not run ok

You are going to have to tell us what the problem is.

Is TPaper your own class?

Regards,
James
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Sorry Mr James,
I renamed rpreview class to tpaper in my file to try the new method.
I wanted to show margins on rpreview if it is possible
Best Regards, Saludos

Falconi Silvio
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Falconi,

OK, but you still didn't tell us what the problem is.

James
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

the problem is this
I want see Line dotted Vertical and Horizontal as Margins of the paper
It is possible make it?
where is the error on the method ?

thanks
Best Regards, Saludos

Falconi Silvio
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Falconi,

You still didn't tell me what the problem is. I am assuming that you are not seeing any lines?

>I renamed rpreview class to tpaper in my file to try the new method.

OK. I also assume you are using TPrinter to draw the page? If so, did you modify TPrinter to call TPaper instead of TPreview? It would actually be easier to take a copy of TPreview and modify it then link it into your test program. Then you don't need to modify TPrinter also.

Also, you are attempting to draw borders 15 pixels from the edge. I don't know of any printer that can print that close to the edge. Perhaps you need to use the real margins of the page, or at least margins that are much futher from the edge.

James
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

I not see any lines
I want see these lines in Metafile in Rpreview window
U mustinsert all data and method into Rpreview class
then you must try test4prn.prg of sample of fwh
when you go in Preview you must see the lines as margins

I need see the real margins of paper

I not see these lines : where is the error ?

thanks
Best Regards, Saludos

Falconi Silvio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Silvio,

Have you tried to paint the lines in a different coordinates ?

Silvio, regarding your classes contributions, we simply had no time to review them and include them yet. We appreciate your contributions, but we have been very busy building 8.05. Thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Antonio,
I try to draw line into different ccordinates I try also with a function
DRAWLINE

Code: Select all


  HB_FUNC( DRAWLINE )
{
   MoveToEx( (HDC) hb_parnl( 1 ), hb_parni( 2 ), hb_parni( 3 ), NULL );
   LineTo( (HDC) hb_parnl( 1 ), hb_parni( 4 ), hb_parni( 5 ) );
}

Best Regards, Saludos

Falconi Silvio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

You have commented that you are using metafiles, right ?

Then maybe you need to paint the lines inside the metafiles, when building them
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

I also try in Tmetafile class

and I insert it on METHOD Paint() after

if ::hMeta != 0
::shadow()
::smargins()

SetMapmode(.......
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

and I found also this information to calculate my margins

aMargins := PageGetMargins () // in 1/100 mm

AEval( aMargins, { |x,y| aMargins[y] := x/1000 } ) // Margin in cm


? aMargins[ 1] --> 2.50
? aMargins[ 2] --> 2.50
? aMargins[ 3] --> 2.50
? aMargins[ 4] --> 2.50
Best Regards, Saludos

Falconi Silvio
Post Reply