public void CreateImagesOfCurrentOpenWindows() { foreach (Form frm in Application.OpenForms) { var bitmap1 = TakeSnapshot(frm); //var bitmapImage = BitmapToImageSource(bitmap1); bitmap1.Save("" + frm.Name + "", System.Drawing.Imaging.ImageFormat.Jpeg); } } public static Bitmap TakeSnapshot(Control ctl) { Bitmap bmp = new Bitmap(ctl.ClientRectangle.Width, ctl.ClientRectangle.Height); System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp); g.CompositingMode = CompositingMode.SourceCopy; g.CopyFromScreen(ctl.PointToScreen(ctl.ClientRectangle.Location), new Point(0, 0), ctl.ClientRectangle.Size); return bmp; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)