首页  编辑  

得到控件显示的图像

Tags: /C#/界面处理/   Date Created:

public Bitmap BitmapFromControl( Control AControl)

{

    if (AControl == null ) return null ;

    Bitmap vBitmap = new Bitmap (AControl . Width, AControl . Height);

    Graphics vGraphics = Graphics . FromImage(vBitmap);

   vGraphics . CopyFromScreen(AControl . PointToScreen( new Point ( 0 , 0 )),

        new Point ( 0 , 0 ), new Size (vBitmap . Width, vBitmap . Height));

    return vBitmap;

}