aBitmap := TBitmap.Create;
                try
                  aBitmap.Width := Memo.Width;
                  aBitmap.Height := Memo.Height;
                  BitBlt(aBitmap.Canvas.Handle, 1, 1, aBitmap.Width, aBitmap.Height, GetDC(Memo.Handle), 0, 0, SRCCOPY);
                  aBitmap.SaveToFile('c:\b.bmp');
                finally
                  FreeAndNil(aBitmap);
                end;只画了右边一部分。不知为啥画不上。用memo.PaintTo(aBitmap.Canvas, 1, 1)倒是可以。可是代码只能在窗体显示后执行才管用。
在oncreate或onshow中都不行。

解决方案 »

  1.   

    >>在oncreate或onshow中都不行。这是正常的,这时memo的窗口样式还没有画出来
      

  2.   

    BitBlt(。);
    Memo.PaintTo(aBitmap.Canvas, 0, 0);
    换成这局
      

  3.   

    你可以在 FormShow 中给窗口Post一个自定义消息(PostMessage)——注意,不能用SendMessage——然后在消息处理中执行绘制的代码,如memo.PaintTo。--
    http://www.agui.googlepages.com
    mailto: agui.cn(a)gmail.com