你怕麻烦吗?
首先 uses qrprntr,qrprev;
定义一个类:
type TMyPreviewInterface = class(TQRStandardPreviewInterface)
public
procedure OnPageAvailable(Sender: TObject;pageno:integer);
function Show(AQRPrinter : TQRPrinter) : TWinControl; override;
function ShowModal(AQRPrinter : TQRPrinter): TWinControl; override;
end;
procedure TMyPreviewInterface.OnPageAvailable(Sender: TObject;pageno:integer);
begin
TQrPreView(Sender).Zoom:=100;
end;
function TMyPreviewInterface.Show(AQRPrinter: TQRPrinter): TWinControl;
begin
result:=TQRStandardPreview(inherited Show(AQRPrinter));
TQRStandardPreview(result).Zoom100.Down:=true;
TQRStandardPreview(result).QRPreview.OnPageAvailable:=OnPageAvailable;
end;
function TMyPreviewInterface.ShowModal(
AQRPrinter: TQRPrinter): TWinControl;
begin
result:=TQRStandardPreview(inherited ShowModal(AQRPrinter));
TQRStandardPreview(result).Zoom100.Down:=true;
TQRStandardPreview(result).QRPreview.OnPageAvailable:=OnPageAvailable;
end;
你显示preview,这样:
procedure TForm1.Button1Click(Sender: TObject);
begin
RegisterPreviewClass(TMyPreviewInterface); //这一行要加
QuickRep1.Preview;
end;