Small Correction.

procedure TForm1.Button1Click(Sender: TObject);
var
  FormHandle: THandle;
  wDC: HDC;
  SrcRect: TRect;
  Bmp: TBitmap;
begin
  Bmp := TBitmap.Create;
  with Bmp do
  try
    FormHandle := Self.Handle;
    Try
      SetForegroundWindow(FormHandle);
      RedrawWindow(FormHandle, nil, 0, RDW_INVALIDATE+RDW_UPDATENOW);
      GetWindowRect(FormHandle, SrcRect);
      Width := SrcRect.Right-SrcRect.Left;
      Height := SrcRect.Bottom-SrcRect.Top;
      wDC := GetWindowDC(FormHandle);
      BitBlt(Canvas.Handle, 0, 0, Width, Height, wDC, 0, 0, SRCCOPY);
      with Printer do
      begin
        BeginDoc;
        Canvas.Draw((PageWidth - Bmp.Width) div 2,
                    (PageHeight - Bmp.Height) div 2, Bmp);
        EndDoc;
      end;
    finally
      ReleaseDC(FormHandle, wDC);
    end;
  finally
    Bmp.Free;
  end;
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to