public static Bitmap PanelToImage(PanelControl control) { int width = control.Size.Width; int height = control.Size.Height; var bmp = new Bitmap(width, height); control.DrawToBitmap(bmp, new Rectangle(0, 0, width, height)); return(bmp); }