Only 3 lines of code are enough
Bitmap b = new Bitmap(pnlOuter.Width, pnlOuter.Height); pnlOuter.DrawToBitmap(b, new Rectangle(0, 0, pnlOuter.Width, pnlOuter.Height)); b.Save("D:\\bitmapImage.jpg");
pnlOuter is a panel that contains all the controls that must be displayed on an image with an extended height to contain all the internal controls. In the contained form, scroll bars may be included.
Nisha source share