将表单捕获到图像

Leo*_* Vo 3 .net c# winforms

我有一个带控件的表单,我需要将此表单捕获到图像中.请帮我.谢谢.

小智 6

//Control cntrl; previously declared and populated
            Bitmap bmp = new Bitmap(cntrl.Width,cntrl.Height);
            cntrl.DrawToBitmap(bmp, new Rectangle(Point.Empty, bmp.Size));
Run Code Online (Sandbox Code Playgroud)