Just recently we got a bug report regarding high dpi system (e.g. 4k screens with a resoltion higher than 200dpi) that our printed graphics are not properly scaled - they do not take the whole width on the screen.
Following code should show the situation:
procedure TForm1.Button1Click(Sender : TObject);
var mf : TMetafile;
begin
Printer.BeginDoc;
mf := TMetafile.Create;
mf.SetSize(10, 10);
with TMetafileCanvas.Create(mf, 0) do
try
MoveTO(0, 0);
LineTo(10, 10);
finally
Free;
end;
Printer.Canvas.StretchDraw( Rect( 0, 0, Printer.PageWidth, Printer.PageHeight ), mf );
mf.Free;
Printer.EndDoc;
end;
That code should stretch the 10x10 metafile on a whole page - this fails on a high dpi system. The code works if the Font/Item scaling is set to a 100% in Windows and also the application has no manifest in it that tells windows that it is dpi aware. I'm using Delphi 2010.