zoukankan      html  css  js  c++  java
  • C# 截取屏幕方法

     this.Visible = false;
                System.Threading.Thread.Sleep(200);
                Bitmap bit = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
                Graphics g = Graphics.FromImage(bit);
                g.CopyFromScreen(new Point(0, 0), new Point(0, 0), bit.Size);
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter = "bmp|*.bmp|jpg|*.jpg|gif|*.gif";
                if (saveFileDialog.ShowDialog() != DialogResult.Cancel)
                {
                    bit.Save(saveFileDialog.FileName);
                }
                g.Dispose();
                this.Visible = true;

    截图窗体方法

     Bitmap bit = new Bitmap(this.Width,this.Height);
                Graphics g = Graphics.FromImage(bit);
                g.CopyFromScreen(this.Location, new Point(0, 0), bit.Size);
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter = "bmp|*.bmp|jpg|*.jpg|gif|*.gif";
                if (saveFileDialog.ShowDialog() != DialogResult.Cancel)
                {
                    bit.Save(saveFileDialog.FileName);
                }
                g.Dispose();
  • 相关阅读:
    修改CentOs开机启动时的timeout
    各种快捷键
    测试实例异常
    测试实例异常
    springBoot中测试类的头注解
    学习笔记9
    stat命令的实现-mystat
    反汇编测试
    学习笔记7
    openssl截图
  • 原文地址:https://www.cnblogs.com/farmer-y/p/6120742.html
Copyright © 2011-2022 走看看