unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, QuickRpt, QRCtrls, ExtCtrls;
type
TForm1 = class(TForm)
QuickRep1: TQuickRep;
TitleBand1: TQRBand;
QRLabel1: TQRLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
QuickRep1.Preview;
end;
procedure TForm1.QuickRep1BeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
var
frm: Tform;
begin
if Screen.ActiveForm = nil then
exit;
if not sameText(Screen.ActiveForm.ClassName, 'TqrProgressForm') then
exit;
frm := Screen.ActiveForm;
frm.Hide;
PrintReport := (application.MessageBox('确定打印吗?', '提示', MB_YESNO + MB_ICONQUESTION) = IDYes);
if PrintReport then
frm.Visible := true;
end;
end.