请问可以去掉quick report 3.0 预览中的打印功能吗?如果可以,怎样做?谢谢!(100分)

  • 主题发起人 主题发起人 48570095
  • 开始时间 开始时间
4

48570095

Unregistered / Unconfirmed
GUEST, unregistred user!
我需要禁止预览中的打印功能。
 
自定义预览窗口。
 
不好意思,我还不知道如何定义预览窗口,能说详细一点吗?谢谢!
 
你搜索一下可以搜到很多的且带源码,这个问题也只有用自定义才可解决问题
 
定義一個過程
proceduredo
FormChanged (Sender : Tobject);
begin
if Assigned(Screen.OnActiveFormChange) then
Screen.OnActiveFormChange:=nil;
if Screen.ActiveForm is TQRStandardPreview then
begin
with TQRStandardPreview(Screen.ActiveForm)do
begin
Left:=0;
Top:=0;
Height:=Screen.Height;
Width:=Screen.Width;
PrintSetup.Visible := False;//打印設置
Print.Visible := False;//打印按鈕
end;
end;
end;

在調用的時候
Screen.OnActiveFormChange:=DoFormChanged;
QR.PreView;
 
stuwe,你好,我按你的方法定义了过程,
type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
QuickRep1: TQuickRep;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
proceduredo
FormChanged(Sender : Tobject);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
proceduredo
FormChanged(Sender : Tobject);
begin
if Assigned(Screen.OnActiveFormChange) then
Screen.OnActiveFormChange:=nil;
if Screen.ActiveForm is TQRStandardPreview then
begin
with TQRStandardPreview(Screen.ActiveForm)do
begin
Left:=0;
Top:=0;
Height:=Screen.Height;
Width:=Screen.Width;
PrintSetup.Visible := False;
Print.Visible := False;
end;
end;
end;

{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
Screen.OnActiveFormChange:=DoFormChanged;
QuickRep1.Preview;
end;

end.
结果编译出错,麻烦你看看错在哪儿,谢谢
编译错误为:[Error] Unit1.pas(32): Undeclared identifier: 'TQRStandardPreview'
[Error] Unit1.pas(32): Operator not applicable to this operand type
 
uses QRPrev;
在上面加上這個單元
 
stuwe,不好意思,他还是编译不过,
[Error] Unit1.pas(17): Unsatisfied forward or external declaration: 'TForm1.DoFormChanged'
麻烦,谢谢,谢谢!
 
新建FORM,放一个REPORT,再放其他,调用FORM.SHOW时REPORT.PRIVIEW即可
 
uses ......//這里加入QRPrev
type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
QuickRep1: TQuickRep;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
proceduredo
FormChanged(Sender : Tobject);//這里要不要都無所謂﹐要的話下面要改
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.DoFormChanged(Sender : Tobject);
//如果上面有定義這個函數﹐下面就要加上TForm1
begin
if Assigned(Screen.OnActiveFormChange) then
Screen.OnActiveFormChange:=nil;
if Screen.ActiveForm is TQRStandardPreview then
begin
with TQRStandardPreview(Screen.ActiveForm)do
begin
Left:=0;
Top:=0;
Height:=Screen.Height;
Width:=Screen.Width;
PrintSetup.Visible := False;
Print.Visible := False;
end;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Screen.OnActiveFormChange:=DoFormChanged;
QuickRep1.Preview;
end;

end.
 
stuwe,真奇怪,我完全和你写的一样,还是有错误!郁闷!
我用的是win2000advace server,不知是不是和操作系统有关,用delphi4 and delphi6都试过,结果一样,[Error] Unit1.pas(18): Unsatisfied forward or external declaration: 'TForm1.DoFormChanged',不过,真的很感谢你!
 
下面是我在D7中測試的源代碼﹐一切正常

unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, QuickRpt, QRPrev;
type
TForm1 = class(TForm)
QuickRep1: TQuickRep;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
proceduredo
FormChanged(Sender: Tobject);
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DoFormChanged(Sender : Tobject);
//¦pªG¤W­±¦³©w¸q³o­Ó¨ç¼Æ¡M¤U­±´N­n¥[¤WTForm1
begin
if Assigned(Screen.OnActiveFormChange) then
Screen.OnActiveFormChange:=nil;
if Screen.ActiveForm is TQRStandardPreview then
begin
with TQRStandardPreview(Screen.ActiveForm)do
begin
Left:=0;
Top:=0;
Height:=Screen.Height;
Width:=Screen.Width;
PrintSetup.Visible := False;
Print.Visible := False;
end;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Screen.OnActiveFormChange:=DoFormChanged;
QuickRep1.Preview;
end;

end.

 
知道問題了
-------------------------------------------------------------------------
private
[red]//[/red]proceduredo
FormChanged(Sender : Tobject);//這里要不要都無所謂﹐要的話下面要改
{ Private declarations }
public
----------------------------------------------------------------------------
第二種解決方法
proceduredo
FormChanged(Sender : Tobject);//改為
[red]procedure TForm1.DoFormChanged(Sender : Tobject);[/red]
 
多人接受答案了。
 
后退
顶部