FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Rpreview Margin
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Rpreview Margin
Posted: Wed May 14, 2008 09: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


 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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Rpreview Margin
Posted: 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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Rpreview Margin
Posted: 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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Rpreview Margin
Posted: Thu May 15, 2008 12:52 AM

Falconi,

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

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Rpreview Margin
Posted: Thu May 15, 2008 07: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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Rpreview Margin
Posted: Thu May 15, 2008 07: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Rpreview Margin
Posted: Thu May 15, 2008 08: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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Rpreview Margin
Posted: Thu May 15, 2008 08: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
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Rpreview Margin
Posted: Thu May 15, 2008 10:02 AM
Antonio,
I try to draw line into different ccordinates I try also with a function
DRAWLINE

  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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Rpreview Margin
Posted: 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
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Rpreview Margin
Posted: 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
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Rpreview Margin
Posted: 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

Continue the discussion