TImage->Canvas and TPrinter->Canvas: fonts problem
Hi,
I should print some texts and graphics on a printer. I would like to create
a preview of the paper sheet on the screen so I inserted a TImage component
on my form. I tried to set the same properties for the printer canvas and
for the image canvas, but I have the following problem: while graphics are
correctly previewed on the TImage, texts appears differently (on TImage they
are smaller then on the sheet). My code is:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TPrinter *MyPrinter = Printer();
Image1->Width = MyPrinter->PageWidth;
Image1->Height = MyPrinter->PageHeight;
Image1->Picture = NULL;
MyPrinter->BeginDoc();
Image1->Canvas->Rectangle(0, 0, 500, 500);
MyPrinter->Canvas->Rectangle(0, 0, 500, 500);
Image1->Canvas->Font->Name = "Tahoma";
MyPrinter->Canvas->Font->Name = "Tahoma";
Image1->Canvas->Font->Size = 24;
MyPrinter->Canvas->Font->Size = 24;
Image1->Canvas->TextOut(10, 10, "Just a test");
MyPrinter->Canvas->TextOut(10, 10, "Just a test");
MyPrinter->EndDoc();
Compared to the image size, the text "Just a test" is smaller on the
screen... Why?
Thanks for any suggestion,
Steve.