csharp截屏

参考地址:http://hi.baidu.com/sageking2/blog/item/5cec2588aac31d92a5c272c9.html/cmtid/a5ca0524166c183d8744f9a1

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace 不用API截屏
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Image myImg = new Bitmap(Screen.AllScreens[0].Bounds.Width, Screen.AllScreens[0].Bounds.Height);
Graphics g = Graphics.FromImage(myImg);
g.CopyFromScreen(new Point(0, 0), new Point(0, 0), Screen.AllScreens[0].Bounds.Size);
myImg.Save("Capture.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
}


posted @ 2011-12-27 11:59  wangkangluo1  阅读(2028)  评论(0编辑  收藏  举报