To customize a function,
public static void Snap (int x, int y, int width, int height)
{
Try
{
This code can also be implemented
Image image = new Bitmap (width, height);
Graphics g = graphics.fromimage (image);
G.copyfromscreen (x, y, 0, 0, new System.Drawing.Size (width, height));
String hour = DateTime.Now.Minute.ToString ();
string second = DateTime.Now.Second.ToString ();
Image. Save (Screenshotpath + "\" + Hour + "_" + Second + ". jpg");
Bitmap image = New Bitmap (getsystemmetrics (0), GetSystemMetrics (1));
using (Graphics g = graphics.fromimage (image))
{
G.copyfromscreen (0, 0, 0, 0, image. Size);
G.dispose ();
String hour = DateTime.Now.Minute.ToString ();
string second = DateTime.Now.Second.ToString ();
Image. Save ("C:" + "\ \" + Hour + "_" + Second + ". jpg");
}
}
Catch
{
}
}
The custom function is then called in a Timersrc_tick, and then it is scheduled to be saved to the specified folder
private void Timersrc_tick (object sender, EventArgs e)
{
Help.snap (0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
}
But after running this code, careful people may find that can be achieved, but some software is not truncated after opening, such as you open a QQ landing window, but you found that there is no QQ landing window, this problem is I have inadvertently found the problem after writing, but because I am also a rookie, So if the request is not high you can refer to, but if you need to intercept all the pictures on the screen, you can on the basis of this code in the study, by the way also give me a code, also learn, we learn together. I hope it will be helpful to everyone.
C # Implementing timed fullscreen and saving code examples in a pre-set folder