截屏Code
public void CaptureScreen()
{
Image myImage;
Graphics g;
myImage = new Bitmap(Screen.PrimaryScreen.Bounds.Size.Width, Screen.PrimaryScreen.Bounds.Size.Height);
g = Graphics.FromImage(myImage);
//截取图片
g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size);
g.Save();
//图像格式
ImageFormat pictureFormat = ImageFormat.Jpeg;
//文件名
string filename = @"C:\" + DateTime.Now.ToString("yyyy-MM-dd_HH_mm_ss") + "." + pictureFormat.ToString();
myImage.Save(filename, pictureFormat);
}