السبت، 9 مايو 2015

I describe how you can take a screen shot by using you c# code, its very simple and easy code: 

//loop over all screens connected to your computer and take a a screenshot.
 foreach (Screen screen in Screen.AllScreens)
                {
                    string screenName = screen.DeviceName;
                    var bmpSs = new Bitmap(screen.Bounds.Width, screen.Bounds.Height, PixelFormat.Format32bppArgb);

                    using (var gfxSs = Graphics.FromImage(bmpSs))
                    {
                        gfxSs.CopyFromScreen(screen.Bounds.X, screen.Bounds.Y, 0, 0, screen.Bounds.Size, CopyPixelOperation.SourceCopy);

//save the image to the file
                            string fileNameGuid = Guid.NewGuid().ToString();
                            string fileName = PicFolder + fileNameGuid + ".png";
                            bmpSs.Save(fileName, ImageFormat.Png);

           }
}