使用PaintToprocedure TForm1.BtnPrintClick(Sender: TObject); var I, Start, Stop: Integer; pointX,pointY : Double; begin PrintDialog1.Options := [poPageNums, poSelection]; PrintDialog1.FromPage := 1; PrintDialog1.MinPage := 1; PrintDialog1.ToPage := PageControl1.PageCount; PrintDialog1.MaxPage := PageControl1.PageCount; if PrintDialog1.Execute then begin with PrintDialog1 do begin Start := 1; Stop := 1; end; with Printer do begin BeginDoc; for I := Start to Stop do begin StringGrid1.PaintTo(Handle, 10, 10); if I <> Stop then NewPage; end; EndDoc; end; end; end;
var
I, Start, Stop: Integer;
pointX,pointY : Double;
begin
PrintDialog1.Options := [poPageNums, poSelection];
PrintDialog1.FromPage := 1;
PrintDialog1.MinPage := 1;
PrintDialog1.ToPage := PageControl1.PageCount;
PrintDialog1.MaxPage := PageControl1.PageCount;
if PrintDialog1.Execute then
begin
with PrintDialog1 do begin
Start := 1;
Stop := 1;
end; with Printer do
begin
BeginDoc;
for I := Start to Stop do
begin
StringGrid1.PaintTo(Handle, 10, 10);
if I <> Stop then
NewPage;
end;
EndDoc;
end;
end;
end;