首页  编辑  

使用打印机内置字体打印

Tags: /超级猛料/Print.打印/   Date Created:

使用打印机内置字体打印

uses Printers;

procedure TForm1.Button1Click(Sender: TObject);

var

tm : TTextMetric;

i : integer;

begin

if PrintDialog1.Execute then begin

Printer.BeginDoc;

Printer.Canvas.Font.Handle := GetStockObject(DEVICE_DEFAULT_FONT);

GetTextMetrics(Printer.Canvas.Handle, tm);

for i := 1 to 10 do begin

Printer.Canvas.TextOut(100,

i * tm.tmHeight +

tm.tmExternalLeading,

'Test');

end;

Printer.EndDoc;

end;

end;