zoukankan      html  css  js  c++  java
  • C# 截屏函数

             截屏函数:

     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 }
  • 相关阅读:
    webpack常见问题 收藏
    ES6 模块
    ES6 Class 类
    ES6 迭代器
    ES6 函数
    ES6 数组
    ES6 对象
    记一次pda(安卓)环境配置流程
    类型转换
    DOM事件
  • 原文地址:https://www.cnblogs.com/lxw0109/p/jieping.html
Copyright © 2011-2022 走看看