TPrinter类不是有画布(Canvas)吗?可以提供一组处理图形需要的方法。还可以使用任何Windows GDI调用或连接大多数第三方的图形库。关键是
运用TPrinter的Canvas.handle属性。他是一个标准的Windows打印机DC,
每当需要一个DC的handle时,都可能使用它。Ps: 1。使用该handle前必须调用Printer方法的BeginDoc方法(或使用
       AssignPrn和Rewrite)。
    2。可以看一看Delphi3开发使用手册,里面有很详尽的介绍,还有例子,
       略微改一改就可以打印图形了。

解决方案 »

  1.   

    how to print a bitmap:Use the following code. Remember to include the Printers unit in the uses clause :Lines followed by // ** are essential. The others are to get the scaling correct
    otherwise you end up with extremely small images. Printer resolutions are higher than
    your screen resolution.
    procedure TForm1.Button1Click(Sender: TObject);
    var
      ScaleX, ScaleY: Integer;
      R: TRect;
    begin
      Printer.BeginDoc;  // **
      with Printer do
      try
        ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
        ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
        R := Rect(0, 0, Image1.Picture.Width * ScaleX,
          Image1.Picture.Height * ScaleY);
        Canvas.StretchDraw(R, Image1.Picture.Graphic);  // **
      finally
        EndDoc;  // **
      end;
    end;