Click here to Skip to main content
15,843,145 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My 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("E:/ScreenShot.bmp",ImageFormat.Bmp);
}


When i run the above code and click the capture button the whole default.aspx page is not displaying.

Im run mode as follows

SNO textbox1
Name textbox2
Age textbox3
ID textbox4
DOB textbox5
Address textbox6
Place textbxo7
State Dropdownlist1
Pincode textbox8
Mobile textbox9
Father Name textbox10
Mother Name textbox11
Permanent Address textbox12

But when i take screen shot in E folder it save as follows

SNO textbox1
Name textbox2
Age textbox3
ID textbox4
DOB textbox5
Address textbox6
Place textbxo7
State Dropdownlist1

The remaining three as follows
Pincode textbox8
Mobile textbox9
Father Name textbox10
Mother Name textbox11
Permanent Address textbox12


The above three is not displaying in E folder the whole screen is not displaying.

From my above code what is the mistake i made please help me.
Posted

1 solution

You can't take a screenshot of the web page in C#: it runs on the server, not the client. That means that the Primary Screen is the web server screen not the client browser. It may do something like what you want in development because both computers are the same PC, but it will do nothing useful in production when the are separated by thousands of miles!

You will need to look at using Javascript for this: Google[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900