Home c# Screenshot of the whole screen

Screenshot of the whole screen

Author

Date

Category

How do I take a screenshot of the entire screen and write it all into a .png or .jpg file? Actually, I myself will perform the recording by pressing a button, but how to make a screenshot? Can someone tell me? Pressing the Print Screen button disappears immediately. And for the screen to appear in PictureBox1. Thanks everyone for the help.


Answer 1, authority 100%

You can do this:

Graphics graph = null;
var bmp = new Bitmap (Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
graph = Graphics.FromImage (bmp);
graph.CopyFromScreen (0, 0, 0, 0, bmp.Size);
bmp.Save ("filename");

How to put a bitmap in picchure boxing, guess?

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions