标签:ar for 文件 代码 sp new size c window
命名空间:
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
相关代码
//获得当前屏幕的分辨率
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(@"c:/1.jpeg");
标签:ar for 文件 代码 sp new size c window
原文地址:http://www.cnblogs.com/mmcmmc/p/3944733.html