请教高手 Frame 上的控件(图片,文本等) 怎么打印出来? 怎么作预览?类似 form 上的控件

解决方案 »

  1.   

    在你的Frame里加一個public方法:此方法是把Frame的所有控件存到一個Bitmap里,然后你再把這個Bitmap傳到你的報表里,甚至存為bmp文件都行!
    Function TFrame1.AssigntoBitmap(aBitmap: TBitmap):Boolean;
    begin
      Result := False ;
      Assert(abitmap<>nil);
      if parent= nil then Exit ;
      if not (Parent is TCustomForm) then Exit ;
      abitmap.Width := width ;
      abitmap.Height := height ;
     abitmap.Canvas.CopyRect(abitmap.Canvas.ClipRect,(Parent as TCustomForm).Canvas,Rect(left,top,left+width,top+height));
      Result := True ;
    end;
      

  2.   

    这样只能存 frame 在窗体上可见的部分
    比如 frame 内容很多 有滚动条的话 看不见的部分怎么打印??
    有没有好办法???谢谢!