narasiman rao

narasiman rao

  • NA
  • 519
  • 766.9k

i tried this code but it is not working

Oct 7 2015 12:45 AM
 
 I am capturing the webpage as screen shot and save the screen shot in folder.

Capture image code as follows

protected void btnCapture_Click(object sender, EventArgs e)
{
Bitmap bitmap = new Bitmap
(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);

Graphics graphics = Graphics.FromImage(bitmap as System.Drawing.Image);
graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);

bitmap.Save(Server.MapPath(@"File\ScreenShot.bmp"), ImageFormat.Bmp);
}


But when i run the above code shows error as follows

A generic error occurred in GDI+.

please kindly help me what is the problem in my above code. 

Answers (1)