B
Butian
Unregistered / Unconfirmed
GUEST, unregistred user!
你先放一个TQRPreview控件,然后在QRReport的OnPreview事件中写上
procedure TForm1.QuickRep1Preview(Sender: TObject);
begin
QRPreview1.QRPrinter := TQRPrinter(Sender);
end;
然后在Form.Show中写
procedure TForm1.FormShow(Sender: TObject);
begin
QuickRep1.Preview;
end;
最后放一个Button写OnClick
procedure TForm1.Button1Click(Sender: TObject);
var
E: TMetaFile;
B: TBitmap;
begin
E := QRPreview1.QRPrinter.GetPage(1);
//想要第几页就GetPage几,从1开始
B := TBitmap.Create;
try
with TMetafileCanvas.Create(E, 0)do
try
B.Height := E.Height;
B.Width := E.Width;
B.Canvas.Draw(0, 0, E);
B.SaveToFile('C:/B.bmp');
finally
Free;
end;
finally
B.Free;
end;
end;
procedure TForm1.QuickRep1Preview(Sender: TObject);
begin
QRPreview1.QRPrinter := TQRPrinter(Sender);
end;
然后在Form.Show中写
procedure TForm1.FormShow(Sender: TObject);
begin
QuickRep1.Preview;
end;
最后放一个Button写OnClick
procedure TForm1.Button1Click(Sender: TObject);
var
E: TMetaFile;
B: TBitmap;
begin
E := QRPreview1.QRPrinter.GetPage(1);
//想要第几页就GetPage几,从1开始
B := TBitmap.Create;
try
with TMetafileCanvas.Create(E, 0)do
try
B.Height := E.Height;
B.Width := E.Width;
B.Canvas.Draw(0, 0, E);
B.SaveToFile('C:/B.bmp');
finally
Free;
end;
finally
B.Free;
end;
end;