下面是网上转载的打印预览窗口程序的一部分。
希望大家一起来看看,有问题在什么地方?
unit Myprv; interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,Dialogs, ComCtrls, ToolWin, qrprntr,Quickrpt, StdCtrls, ExtCtrls,qrextra,qrhtml; type
TMyPreview = class(TForm)
QRPreview1: TQRPreview;
ToolBar1: TToolBar;
quickrep1:tquickrep;
(其 余 成 员 变 量 和 成 员 方 法 声 明 略。)
private
{ Private declarations }
FPageCount : integer; // 生 成 报 表 的 总 页 数
public
{ Public declarations }
CurRep : TQuickRep; // 所 预 览 的 报 表
procedure UpdatePanelShow;
end; implementation {$R *.DFM}
重 载TQuickRep 的OnPreview 事 件, 输 入 如 下 代 码
procedure TRptForm.RptFormPreview(Sender: TObject);
begin
with TMyPreview.Create(Application) do
begin
QRPreview1.QRPrinter := TQRPrinter(Sender);
CurRep:=self; ///执行到这里; 系统出错误信息
Show;
end;
end; 系统出错的信息是:
incompatibale types:'tquickrep' and 'tmypreview'
同时:我请问
1:打印预览窗体的Name为MyPreview,而QuickRep的OnPreview 事 件
procedure TRptForm.RptFormPreview(Sender: TObject)是TRptForm,为什么?
其实我的quickrep1的name是RptForm。
2:在 uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,Dialogs, ComCtrls, ToolWin, qrprntr,Quickrpt, StdCtrls, ExtCtrls,qrextra,qrhtml; 系统提示找不到qrhtml.dcu.我的DELPHL是D5。
希望大家一起来看看,有问题在什么地方?
unit Myprv; interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,Dialogs, ComCtrls, ToolWin, qrprntr,Quickrpt, StdCtrls, ExtCtrls,qrextra,qrhtml; type
TMyPreview = class(TForm)
QRPreview1: TQRPreview;
ToolBar1: TToolBar;
quickrep1:tquickrep;
(其 余 成 员 变 量 和 成 员 方 法 声 明 略。)
private
{ Private declarations }
FPageCount : integer; // 生 成 报 表 的 总 页 数
public
{ Public declarations }
CurRep : TQuickRep; // 所 预 览 的 报 表
procedure UpdatePanelShow;
end; implementation {$R *.DFM}
重 载TQuickRep 的OnPreview 事 件, 输 入 如 下 代 码
procedure TRptForm.RptFormPreview(Sender: TObject);
begin
with TMyPreview.Create(Application) do
begin
QRPreview1.QRPrinter := TQRPrinter(Sender);
CurRep:=self; ///执行到这里; 系统出错误信息
Show;
end;
end; 系统出错的信息是:
incompatibale types:'tquickrep' and 'tmypreview'
同时:我请问
1:打印预览窗体的Name为MyPreview,而QuickRep的OnPreview 事 件
procedure TRptForm.RptFormPreview(Sender: TObject)是TRptForm,为什么?
其实我的quickrep1的name是RptForm。
2:在 uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,Dialogs, ComCtrls, ToolWin, qrprntr,Quickrpt, StdCtrls, ExtCtrls,qrextra,qrhtml; 系统提示找不到qrhtml.dcu.我的DELPHL是D5。
TRptForm 是什么类?
CurRep:=self; ///执行到这里; 系统出错误信息
这里出错是正常的
CurRep : TQuickRep; // 所 预 览 的 报 表
CurRep是TQuickRep类的实例,Self代表 TMyPreview = class(TForm)
显然两个类是不能这么相等的qrhtml有可能不是Delphi自带的,自己写或第三方控件
该怎么改正