Board index » delphi » TPrinter Left margin in Printing Memo box

TPrinter Left margin in Printing Memo box

I set   R : Trect
then R.Left := 20;
then when I
      DrawText(Printer.Handle,
          PChar(OpenDialog.FileName), -1, R, DT_LEFT);
I doesn't make any difference what I set R.Left to, I cannot control my
left Margin.
Also it doesn't matter if I use DT_LEFT or DT_CENTER.

I want to control the left margin of the table i put on a memo box.  The
reason I put it in
a memo box, is because there is more than a table to be printed and
displayed

Is there any help for an old man?

charles j. arnett
e...@instrulab.com

 

Re:TPrinter Left margin in Printing Memo box


Quote
> I set   R : Trect
> then R.Left := 20;
> then when I
>       DrawText(Printer.Handle,
>           PChar(OpenDialog.FileName), -1, R, DT_LEFT);
> I doesn't make any difference what I set R.Left to, I cannot control my
> left Margin. Also it doesn't matter if I use DT_LEFT or DT_CENTER.

Did you set all four elements of R? Did you try higher values than 20? On
an average laser printer 20 dots would be considerably less than 1/10
inch.

You convert from a measure in inches to printer dots with

 x_margin_dots := Round( x_margin_inches * GetDeviceCaps( printer.handle,
LOGPIXELSX ));

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitely requested!

Re:TPrinter Left margin in Printing Memo box


Quote
Peter Below (TeamB) wrote:
> > I set   R : Trect
> > then R.Left := 20;
> > then when I
> >       DrawText(Printer.Handle,
> >           PChar(OpenDialog.FileName), -1, R, DT_LEFT);
> > I doesn't make any difference what I set R.Left to, I cannot control my
> > left Margin. Also it doesn't matter if I use DT_LEFT or DT_CENTER.

> Did you set all four elements of R? Did you try higher values than 20? On
> an average laser printer 20 dots would be considerably less than 1/10
> inch.

yes, I used 8 and 300 but could not tell a difference.
I solved by inserting spaced in fixed font and it works well.
I am going to keep your suggestion for future use.

I ran into problems with page length also.  I printed out my memobox on three
differeent
printers and it separated my pages differently on each printer.  So i set
page length as
a certain number of lines.

Quote

> You convert from a measure in inches to printer dots with

>  x_margin_dots := Round( x_margin_inches * GetDeviceCaps( printer.handle,
> LOGPIXELSX ));

Thanks
Quote

> Peter Below (TeamB)  100113.1...@compuserve.com)
> No e-mail responses, please, unless explicitely requested!

Other Threads