Capture Screen using C#

private Bitmap screenBitmap; // It will grab the size of your current screen.
Rectangle screenRegiion = Screen.AllScreens[0].Bounds;

 // It will create the bitmap of the specified region.
screenBitmap = new Bitmap(1024, 768, PixelFormat.Format32bppArgb);

// It will copy the current screep image to the bitmap image.
Graphics screenGraphics = Graphics.FromImage(screenBitmap);
screenGraphics.CopyFromScreen(screenRegiion.Left, screenRegiion.Top, 0, 0, screenRegiion.Size);

screenBitmap.Save(@”c:\test.bmp”);


About this entry