[DUG] Print Preview

John Bird johnkbird at paradise.net.nz
Fri Nov 25 14:56:38 NZDT 2005


Was experimenting with adding a print preview by copying from the
Printer.canvas to a form.canvas and showing it

PrintRect,PreviewRect:TRect;
 begin
        duPageWidth:=GetDeviceCaps(Printer.Canvas.Handle,PHYSICALWIDTH);
        duPageHeight:=GetDeviceCaps(Printer.Canvas.Handle,PHYSICALHEIGHT);

      //show this page with copyrect command
      PrintRect:=Rect(10,10,duPageWidth-20,duPageHeight-20);
      PreviewRect:=Rect(10,10,frmjkblPrint.Width-20,frmjkblPrint.Height-20);
      frmjkblPrint.Canvas.CopyRect(PreviewRect,Printer.Canvas,PrintRect);
      frmjkblPrint.show;

But it doesn't work...
Is it legit to copyrect from Printer.canvas?


John




More information about the Delphi mailing list