• delphi 多线程fastreport简单实例


    type

    Tmythread = class(TThread)
    protected
      frxrprttmp: TfrxReport;
      procedure Execute; override;
      procedure testPrintThread();
    public
      constructor Create(frxrprt: TfrxReport);
    end;

    var
    Form2: TForm2;

    implementation

    {$R *.dfm}

    constructor Tmythread.Create(frxrprt: TfrxReport);
    begin
      frxrprttmp := frxrprt;
      inherited Create(False); //false表示线程对象的execute()方法在执行create()方法后立刻自动执行,否则需要在某个地方通过resume后激活该线程
      FreeOnTerminate := False; {这可以让线程执行完毕后随即释放}
    end;

    procedure Tmythread.Execute();
    begin
      Self.Synchronize(testPrintThread);
    end;

    procedure Tmythread.testPrintThread();
    begin
      frxrprttmp.Preview := nil;
      frxrprttmp.PrepareReport;
      frxrprttmp.PrintOptions.ShowDialog := false;
      frxrprttmp.Print;
    end;

    procedure TForm2.cxbtn_designClick(Sender: TObject);
    begin
      frxrprt1.DesignReport();
    end;

    procedure TForm2.cxbtn_openfr3Click(Sender: TObject);
    begin
      if OpenDialog1.Execute then
      begin
        cxTextEdit_1.Text := OpenDialog1.FileName;
      end;
    end;

    procedure TForm2.cxbtn_previewClick(Sender: TObject);
    begin
      frxrprt1.PrepareReport;
      frxrprt1.ShowReport;
    end;

    procedure TForm2.cxbtn_printClick(Sender: TObject);
    var
      i: Integer;
      mythread: Tmythread;
    begin
      for i := 0 to 10 do
      begin
        mythread := Tmythread.Create(frxrprt1);
      end;
    end;

  • 相关阅读:
    套接字I/O模型-WSAAsyncSelect
    套接字I/O模型-完成端口IOCP
    套接字I/O模型-WSAEventSelect(转载)
    Win7+VS2010环境下CEGUI 0.8.4编译过程详解
    数组去重统计排序
    计算当前月有几天
    前端开发仓库
    Jquery中bind(), live(), on(), delegate()四种注册事件的优缺点,建议使用on()
    图表那些事
    图标字体,矢量图标
  • 原文地址:https://www.cnblogs.com/yangxuming/p/7153920.html
Copyright © 2020-2023  润新知