截图

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");

原文地址:https://www.cnblogs.com/tiankong2012/p/3526010.html