C#
static void toScreen()
{
//获取到主显示器
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("D://cutscreen.jpg");
}
标签:截图,C#,Graphics,myImage,全屏,rc,new,iHeight
From: https://www.cnblogs.com/hezq/p/17134763.html