rt

解决方案 »

  1.   

    procedure PrintPanel(Panel: TPanel; SLeft, STop, SWidth, SHeight, Left, Top: LongInt;
      HScale, ZScale: Real);
    var
      WJDC: HDC;
      WJBitMap: TBitMap;
      Info: PBitMapInfo;
      InfoSize, ImageSize: DWORD;
      Image: Pointer;
    begin
      Printer.BeginDoc;  WJBitMap := TBitMap.Create;
      WJBitMap.Width := SWidth;
      WJBitMap.Height := SHeight;  WJDC := GetDC(Panel.Handle);
      BitBlt(WJBitMap.Canvas.Handle, 0, 0, SWidth, SHeight, WJDC, SLeft, STop, SRCCOPY);
      ReleaseDC(Panel.Handle, WJDC);  GetDIBSizes(WJBitMap.Handle, InfoSize, ImageSize);
      GetMem(Info, InfoSize);
      GetMem(Image, ImageSize);
      GetDIB(WJBitMap.Handle, 0, Info^, Image^);  StretchDIBits(Printer.Canvas.Handle, Left, Top, Round((Panel.Width - 2) * HScale),
        Round((Panel.Height - 2) * ZScale), 0, 0, Info^.bmiHeader.biWidth,
        Info^.bmiHeader.biHeight, Image, Info^, DIB_RGB_COLORS, SRCCOPY);
      FreeMem(Image, ImageSize);
      FreeMem(Info, InfoSize);
      WJBitMap.Free;
      Printer.EndDoc;
    end;
      

  2.   

    uses printers;
    procedure TForm1.Button1Click(Sender: TObject);
    var
     Bitmap: TBitmap;
    begin
     Bitmap := TBitmap.Create;
     Bitmap.Width := Panel1.Width;
     Bitmap.Height := Panel1.Height;
     try
       Panel1.PaintTo(Bitmap.Canvas,0,0);
       Bitmap.SaveToFile('g:\jjj.bmp');
       //Use Bitmap Do SomeThing..
     finally
       Bitmap.Free;
     end;
    ////
    ///////打印image
    //////
    Image1.Picture.LoadFromFile('f:\jjj.bmp');
     with Image1.Picture.Bitmap do
        begin
        Printer.BeginDoc;
        Printer.Canvas.StretchDraw(Canvas.ClipRect,Image1.Picture.Bitmap);
        Printer.EndDoc;
        end; 
    end;    
     
    这样 效果不错
      

  3.   

    uses printers;Printer.BeginDoc;
            panel1.PaintTo(Printer.Canvas,1,1);
            Printer.EndDoc;这样也可以
      

  4.   

    uses printers;Printer.BeginDoc;
    panel1.PaintTo(Printer.Canvas,1,1);
    Printer.EndDoc;__________________________________________________用上面的方法打印出来的东西怎么变得很小(长宽只有1厘米)?
      

  5.   

    procedure PrintPanel(Panel: TPanel; SLeft, STop, SWidth, SHeight, Left, Top: LongInt;
      HScale, ZScale: Real);________________________________________________________________HScale, ZScale是什么?
      

  6.   

    最简便的方法可以用rm报表控件包的RMReport,然后一句代码就可以了