我的程序如下:
procedure TForm1.Button1Click(Sender: TObject);
var
  i,count:integer;
begin
  if(printdialog1.Execute) then
  begin
    printer.Canvas.Font:=testfont.Label1.Font;
    count:=strtoint(edit5.text);
    for i:=1 to count do
    begin
    printer.BeginDoc;
    application.ProcessMessages;
    printer.Canvas.Textout(trunc(printer.PageWidth*0.3),trunc(printer.PageHeight*0.8),inttostr(i));
    printer.NewPage;
    printer.Canvas.Textout(trunc(printer.PageWidth*0.3),trunc(printer.PageHeight*0.8),inttostr(i));
    printer.EndDoc;
    end;
  end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if(printer.Printing) then
  printer.Abort;
end;
結果在打印時,點擊button2時,打印無法停止,請問大家這是為什麼?
怎樣才能停止打印?

解决方案 »

  1.   

    procedure BeginDoc;DescriptionCall BeginDoc to initiate a print job. If the print job is sent successfully, the application calls EndDoc to end the print job. The print job won't actually start printing until EndDoc is called.
    procedure EndDoc;DescriptionEndDoc terminates the print job (and closes the currently open Text). The print job will begin printing on the printer after a call to EndDoc.After the application calls EndDoc, the printer begins printing. Use EndDoc after successfully sending a print job to the printer. If the print job isn't successful, use the Abort method.
      请注意“If the print job isn't successful, use the Abort method.”,不知对否?
      

  2.   

    可以直接用printer.EndDoc;停止打印呀
      

  3.   

    免费使用
    免费升级超越水晶报表,是我们的目标
    彻底解除程序员负担,极大提高用户设定灵活性
    LLanV报表工具,经过了10000行以上数据的压力测试,性能优良!其中一部分功能如下:  
    1.支持资料卡(比如:个人简历),表单(比如:销售定单),报表(比如:销售月报表)的预览打印
    2.不用任何设定,就可以默认产生专业的页面
    3.用户可以一次性设定企业标准样式(比如:公司标志,台头)
    4.支持文本,线条,方框,图片,等报表元素
    5.对各报表元素和报表区域等提供丰富的属性
    6.用户可以在运行期间编辑文本,线条,方框,图片,明细列, 操作简单
    7.支持同一列相同数据合并成一个格
    8.可以在运行期间增删,调换明细列
    9.提供多种报表风格
    10.支持页合计,总计
    11.支持的套打报表
    12.支持MIS开发的各种开发工具:如VC、VB、Delphi等
    13.可以直接连接数据库
    14.用户可以把设定后的报表样式保存为报表样式文件
    15.报表头和报表尾均可多于一页
    16.报表样式文件格式完全开放
    17.可以实现中国式复杂报表样式
    18.无须编程请发EMAIL给[email protected]