I had posted the following msg about 2 days ago but didn't get
an answer to my question -- still clueless about the problem
I'm dealing with so I'm posting it again. Thanx.
---------------------------------------------------
Hi All,
I'm trying to use Canvases in Delphi to print some graphics
and text out. When I use the canvas associated with my Form everything
works just fine, but when I try and execute the same code using the
canvas associated with my Printer object things go sour -- It seems
as if the Printer.Canvas is using a different coordinate system
than Form.Canvas. Apparently, Printer.Canvas has a much denser resolution.
So, the statement:
TextOut(480, 20, 'Hello World');
'Hello World' appears at the right side of the Form (from my perpective)
when using Form.Canvas, but it PRINTS at the left hand side
on the PAPER (using Printer.Canvas), moving ever so slightly to
the right as if the x-coordinate of 480 is reached somewhere close
to the left margin -- In order to push the text out to the right using
Printer.Canvas the x-coordinate has to be set to very high values
e.g. 1000, 2000.
At first, I thought that somehow Printer.Canvas was using a different
unit of resolution e.g. twips as opposed to pixels, but after going
thru the manuals and online help exhaustively, I found no mention of
twips. Also, I've been unable to find any info on how I can change
the coordinate system of Printer.Canvas to a less dense scale.
Comments, suggestions?
Thanx much,
Ali
-- Here's the entire code snippet --
{ Print on Form.Canvas -- WORKS FINE}
Form1.Show;
Form1.Canvas.Font.Name := 'Times New Roman';
Form1.Canvas.Font.Style := [fsBOLD];
Form1.Canvas.Font.Size := 20;
Form1.Canvas.TextOut(480, 20, 'Hello World');
{ Print on Printer.Canvas -- DOESN'T WORK LIKE IT SHOULD}
Printer.BeginDoc;
Printer.Canvas.Font.Name := 'Times New Roman';
Printer.Canvas.Font.Style := [fsBOLD];
Printer.Canvas.Font.Size := 20;
Printer.Canvas.TextOut(480, 20, 'Hello World');
Printer.EndDoc;