• c#实现截取电脑全屏


    转载自http://blog.csdn.net/lijgame/article/details/1447921

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Linq;

    using System.Text;

    using System.Windows.Forms;

    using System.Drawing.Imaging;

    namespace first

    {    

      public partial class Form2 : Form    

       {        

         public Form2()        

        {            

          InitializeComponent();        

        }        

        private void button1_Click(object sender, EventArgs e)        

        {            

          //获得当前屏幕的分辨率            

          Screen scr = Screen.PrimaryScreen;            

          Rectangle rc = scr.Bounds;            

          int iWidth = rc.Width;            

          int iHeight = rc.Height;            

          //创建一个和屏幕一样大的Bitmap            

          Image myImage = new Bitmap(iWidth, iHeight);            

          //从一个继承自Image类的对象中创建Graphics对象            

          Graphics g = Graphics.FromImage(myImage);            

          //抓屏并拷贝到myimage里            

          g.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(iWidth, iHeight));            

          //保存为文件            

          myImage.Save("1.jpg");        

        }    

      }

    }

  • 相关阅读:
    Extjs combobox设置默认值
    sql 游标循环遍历
    .NET中的DES对称加密
    Asp.Net生命周期
    浅谈C#随机数发生器
    面向对象-多态 附抽象
    c#常用的一些命名空间
    c#面向对象编程基础
    string应用
    [自习任我行]第二阶段任务跟踪10
  • 原文地址:https://www.cnblogs.com/liyanzhui/p/3957052.html
Copyright © 2020-2023  润新知