Rpreview Margin

Rpreview Margin

Postby Silvio » Wed May 14, 2008 9:36 am

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  Expand view
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
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby James Bott » Wed May 14, 2008 12:05 pm

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Silvio » Wed May 14, 2008 11:18 pm

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
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby James Bott » Thu May 15, 2008 12:52 am

Falconi,

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

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

Postby Silvio » Thu May 15, 2008 7:06 am

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
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby James Bott » Thu May 15, 2008 7:43 am

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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Silvio » Thu May 15, 2008 8:14 am

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
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Thu May 15, 2008 8:51 am

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
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Thu May 15, 2008 10:02 am

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

Code: Select all  Expand view

  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
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Thu May 15, 2008 10:42 am

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
Antonio Linares
Site Admin
 
Posts: 41406
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Thu May 15, 2008 11:00 am

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

Postby Silvio » Thu May 15, 2008 11:07 am

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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 34 guests