截屏函数:

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Windows.Forms;
 5 //lxw0109
 6 using System.Drawing;
 7 
 8 
 9 namespace WindowsFormsApplication1
10 {
11     static class Program
12     {
13         [STAThread]
14         static void Main()
15         {
16             //下面三行不用管
17             Application.EnableVisualStyles();
18             Application.SetCompatibleTextRenderingDefault(false);
19             Application.Run(new Form1());
20 
21             //调用截屏函数
22             func();
23         }
24         public static void func()   //截屏函数
25         {
26             int width = Screen.PrimaryScreen.Bounds.Width;
27             int height = Screen.PrimaryScreen.Bounds.Height;
28             Bitmap btm = new Bitmap(width, height);
29             using (Graphics g = Graphics.FromImage(btm))
30             {
31                 g.CopyFromScreen(0, 0, 0, 0, Screen.AllScreens[0].Bounds.Size);
32                 g.Dispose();
33                 string save = "F:\\" + DateTime.Now.ToString("yyyymmddhhmmssmmmm") + ".jpg";
34                 btm.Save(save);
35             }
36         }
37     }
38 }

 

相关文章:

  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2022-02-09
  • 2021-08-21
猜你喜欢
  • 2022-12-23
  • 2021-08-20
  • 2022-12-23
  • 2021-09-16
  • 2021-08-04
  • 2021-08-19
相关资源
相似解决方案