zoukankan      html  css  js  c++  java
  • 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");        

        }    

      }

    }

  • 相关阅读:
    BeautifulSoup
    python爬虫操作excel
    requests
    urllib
    线程的基本用法
    WebView
    播放多媒体文件
    调用摄像头和相册
    03 pycharm编辑默认模板
    测试
  • 原文地址:https://www.cnblogs.com/liyanzhui/p/3957052.html
Copyright © 2011-2022 走看看