Introduction: Here I need to take a snap shot my screen with my web application on just a button click.
Requirement: For this I need only a Button, by clicking on that the snap shot of screen is taken and saved automatically.
Namespaces Required:
using System.Drawing;
using System.Drawing.Imaging;
Click event of Button:
Bitmap bitmap = new Bitmap(1000, 1000); //declaring size of snap
Graphics graphics = Graphics.FromImage(bitmap as System.Drawing.Image);
graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
bitmap.Save(@"c:\Snapshot\screenshot1.bmp", ImageFormat.Bmp); //Path to save image
Result:
This code will save the snap shot of screen to the location defined in the code.
Requirement: For this I need only a Button, by clicking on that the snap shot of screen is taken and saved automatically.
Namespaces Required:
using System.Drawing;
using System.Drawing.Imaging;
Click event of Button:
Bitmap bitmap = new Bitmap(1000, 1000); //declaring size of snap
Graphics graphics = Graphics.FromImage(bitmap as System.Drawing.Image);
graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
bitmap.Save(@"c:\Snapshot\screenshot1.bmp", ImageFormat.Bmp); //Path to save image
Result:
This code will save the snap shot of screen to the location defined in the code.