gunadmtdomains
Member
Dear Friends Good day,
how to capture a screen shot without using exception stage kindly guide me.
how to capture a screen shot without using exception stage kindly guide me.
string Error="";
try
{
Bitmap printscreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(printscreen as Image);
graphics.CopyFromScreen(0, 0, 0, 0, printscreen.Size);
Clipboard.Clear();
Clipboard.SetImage(printscreen);
printscreen.Save(@"D:\\ScreenShot.jpg",ImageFormat.Jpeg);
Success=true;
}catch(Exception e)
{
Success=false;
Error=e.Message;
}
ErrorMessage=Error;
Dim area As Rectangle
Dim capture As System.Drawing.Bitmap
Dim graph As Graphics
area = My.Computer.Screen.Bounds
capture = New System.Drawing.Bitmap(area.Width, area.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
graph = Graphics.FromImage(capture)
graph.CopyFromScreen(area.X, area.Y, 0, 0, area.Size, CopyPixelOperation.SourceCopy)
FullSavedScreenshotPath = OutputFolderPath & OutputFileNameWithoutExtension & ".jpg"
capture.Save (FullSavedScreenshotPath, System.Drawing.Imaging.ImageFormat.jpeg)
ScreenshotImage = capture