How to print a TImage ?
How to print a TImage ?
From: http://www.delphitricks.com
Befor dowing this trick, please add Printers to your uses.
Code:
..........
uses
Printers;
procedure TForm1.Button1Click(Sender: TObject);
var
ScaleX, ScaleY: Integer;
RR: TRect;
begin
with Printer do
begin
BeginDoc;
try
ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
RR := Rect(0, 0, Image1.picture.Width * scaleX, Image1.Picture.Height * ScaleY);
Canvas.StretchDraw(RR, Image1.Picture.Graphic);
finally
EndDoc; //Methode EndDoc beendet den aktuellen Druckauftrag und schließt die
end;
end;
end;