我有一段收集的据说可以实现stringgrid打印预览的代码
可是我用后,什么也没有看到。请朋友们诊断诊断是怎么回事?uses printers;procedure TForm1.Button1Click(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
StringGrid.PaintTo(Handle, 10, 10);
if I <> Stop then
NewPage;
end;
EndDoc;
end;
end;
end;
可是我用后,什么也没有看到。请朋友们诊断诊断是怎么回事?uses printers;procedure TForm1.Button1Click(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
StringGrid.PaintTo(Handle, 10, 10);
if I <> Stop then
NewPage;
end;
EndDoc;
end;
end;
end;
这段代码是打印用的