Código
PrintForm
uses
Windows, SysUtils, Printers, Forms, Graphics, Controls, Classes;
.
.
.
procedure PrintForm(frm: TForm);
var
bmp: TBitMap;
x, y, WDPI, HDPI: Integer;
OldColor: TColor;
begin
Screen.Cursor := crHourGlass;
OldColor := frm.Color;
frm.Color := clWhite;
frm.Update;
bmp := frm.GetFormImage;
with Printer do
begin
Orientation := poLandscape;
BeginDoc;
HDPI := PageHeight div 8;
WDPI := PageWidth div 8;
x := PageWidth - Round(WDPI * 0.4); {0.4" margem direita}
y := PageHeight - Round(HDPI * 0.5); {0.5" Altura do rodapé}
Canvas.StretchDraw(Rect(0, 0, x, y), bmp);
EndDoc;
end;
bmp.Free;
frm.Color := OldColor;
Screen.Cursor := crDefault;
end;
Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009