Jan 9, 2009

Capturing screenshots using C#

using System.Drawing.Imaging;

private static Bitmap bmpScreenshot;

private static Graphics gfxScreenshot;



bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
bmpScreenshot.Save("filename.ping");

0 comments:

Post a Comment

Your Feedback and comments are appreciated