Sunday, March 7, 2010

First of all include using System.Drawing.Imaging; namespace in your project.
The Following method will return a bitmap image of the active desktop !

public Bitmap ScreenShot()
{
Bitmap screenShotBMP;
screenShotBMP = null;
screenShotBMP = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
Graphics screenShotGraphics = Graphics.FromImage(screenShotBMP);
screenShotGraphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size,
CopyPixelOperation.SourceCopy);
return screenShotBMP;
}
 


Download Demo Application

Download VS2008 Project Scr Code

That's It !
Enjoy !

0 comments:

Post a Comment