好了,我把那三句话执行了十几遍,打印机动都没动一下。改成begin
DOC和ENDDOC才
会走纸一张。估计hn你的打印机坏了,或质量不好,或打印机驱动程序不好,或你的
系统有问题,或者。。。。
我的是WIN2000,HP6L(原厂驱动程序),程序如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
Printers;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
printer.canvas.font.name:='宋体' ;
printer.canvas.font.size:=10 ;
printer.canvas.textwidth('asdfsafd') ;//这里什么事都没有发生
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
printer.begin
Doc;
printer.EndDoc;
//这里会走纸一张。
end;
end.