截图

string tempImagePath = Application.StartupPath;
string temp = tempImagePath + "\\CurrentScreenImage";
Directory.CreateDirectory(@temp);
Image i = new Bitmap(this.Width, this.Height);
Graphics g = Graphics.FromImage(i);
g.CopyFromScreen(new Point(this.Location.X, this.Location.Y), new Point(0, 0) , new Size(this.Width, this.Height));
i.Save(@temp + "\\" + DateTime.Now.ToString("yyyyMMdd") + ".jpg");
g.Dispose();
MessageBox.Show("OK");

posted on 2014-01-19 16:29  #天空#  阅读(152)  评论(0编辑  收藏  举报

导航