To get the screen shot of the Monitor

Posted by Neeks under C# category on | Views : 2733
//You can take the screen shot of the monitor using the following code

 Bitmap screen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);           
Graphics graphics = Graphics.FromImage((Image)screen);
graphics.CopyFromScreen(0, 0, 0, 0, new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
screen.Save( @"C:\filename.jpg", ImageFormat.Jpeg);

Comments or Responses

Posted by: Neeks on: 3/5/2009 Level:Bronze | Status: [Member]
You have to add the reference for following namespaces:
using System.Drawing;
using System.Drawing.Imaging;

You have to also add the reference of

for executing this code.


Login to post response