//Delphi Help'de PaintTo ile ilgili ararsanız buna benzer bir ornek
//verilmiş. PaintTo ilginç bir komut, inceleyiniz.
procedure TTestPrintPreviewDlg.PrintCmdExecute(Sender: TObject);
var i,j,k,start,stop :integer;
oldpage,oldZoom:integer;
begin
PrintDialog1.FromPage := 1;
PrintDialog1.MinPage := 1;
PrintDialog1.ToPage := SynEditPrintPreview.PageCount;
PrintDialog1.MaxPage := SynEditPrintPreview.PageCount;
oldpage:=SynEditPrintPreview.PageNumber-1;
oldZoom:=SynEditPrintPreview.ScalePercent;
SynEditPrintPreview.FirstPage;
if PrintDialog1.Execute then begin
for i:=1 to PrintDialog1.Copies do
begin
if PrintDialog1.PrintRange=prAllPages then //tumunu yaz
SynEditPrintPreview.Print
else begin
start:= PrintDialog1.FromPage-1; //belli yerler
stop:= PrintDialog1.ToPage-1;
SynEditPrintPreview.ScalePercent:=300;
SynEditPrintPreview.UpdatePreview;
with Printer do //burası motor
begin
BeginDoc;
for j := Start to Stop do
begin
for k:=1 to j do SynEditPrintPreview.NextPage;
SynEditPrintPreview.PaintTo(Handle, 10, 10);
if j<> Stop then NewPage;
end;
EndDoc;
end;
end;
end;
end;
SynEditPrintPreview.FirstPage;
for k:=1 to oldpage do SynEditPrintPreview.NextPage;
SynEditPrintPreview.ScalePercent:=oldZoom;
SynEditPrintPreview.UpdatePreview;
end;