建form14,源码如下
unit print;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
qrprntr, Buttons, ExtCtrls, StdCtrls;
type
TForm14 = class(TForm)
Panel1: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
QRPreview1: TQRPreview;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form14: TForm14;
implementation
{$R *.DFM}
procedure TForm14.SpeedButton3Click(Sender: TObject);
begin
QRPreview1.QRPrinter.PrintSetup;
end;
procedure TForm14.SpeedButton4Click(Sender: TObject);
begin
close;
end;
procedure TForm14.SpeedButton1Click(Sender: TObject);
begin
QRPreview1.QRPrinter.Print;
end;
procedure TForm14.BitBtn1Click(Sender: TObject);
begin
QRPreview1.PageNumber := QRPreview1.PageNumber-1;
// UpdatePanelShow;
end;
procedure TForm14.BitBtn2Click(Sender: TObject);
begin
QRPreview1.PageNumber := QRPreview1.PageNumber+1;
end;
end.
建成表form13,这个窗口上为delphi中用自带的quickreport制作出来的preview,源码如下
unit printqr;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
StdCtrls, ExtCtrls, Forms, Quickrpt, QRCtrls;
type
TForm13 = class(TForm)
QuickRep1 : TQuickRep;
TitleBand1 : TQRBand;
QRLabel1 : TQRLabel;
PageFooterBand1 : TQRBand;
ColumnHeaderBand1 : TQRBand;
DetailBand1 : TQRBand;
QRLabel2 : TQRLabel;
QRExpr1 : TQRExpr;
QRLabel3 : TQRLabel;
QRExpr2 : TQRExpr;
QRLabel4 : TQRLabel;
QRExpr3 : TQRExpr;
QRLabel5 : TQRLabel;
QRExpr4 : TQRExpr;
QRLabel6 : TQRLabel;
QRExpr5 : TQRExpr;
QRLabel7 : TQRLabel;
QRExpr6 : TQRExpr;
QRLabel8 : TQRLabel;
QRExpr7 : TQRExpr;
QRBand1: TQRBand;
QRLabel9: TQRLabel;
QRSysData1: TQRSysData;
QRShape1: TQRShape;
QRShape2: TQRShape;
QRShape3: TQRShape;
QRShape4: TQRShape;
QRShape5: TQRShape;
QRShape6: TQRShape;
QRShape7: TQRShape;
QRShape8: TQRShape;
QRShape9: TQRShape;
QRShape10: TQRShape;
QRShape11: TQRShape;
QRShape12: TQRShape;
QRShape13: TQRShape;
QRExpr8: TQRExpr;
QRLabel10: TQRLabel;
procedure QuickRep1Preview(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
end;
var
Form13: TForm13;
implementation
uses print;
{$R *.DFM}
procedure TForm13.QuickRep1Preview(Sender: TObject);
begin
form14.QRPreview1.QRPrinter := form13.QuickRep1.QRPrinter;
form14.Show;
end;
procedure TForm13.FormCreate(Sender: TObject);
begin
shortdateformat:='yyyy-mm-dd';
end;
end.