//屏幕寬
int iWidth = Screen.PrimaryScreen.Bounds.Width;
//屏幕高
int iHeight = Screen.PrimaryScreen.Bounds.Height;
//按照屏幕寬高創建位圖
Image img = new Bitmap(iWidth, iHeight);
//從一個繼承自Image類的對象中創建Graphics對象
Graphics gc = Graphics.FromImage(img);
//抓屏並拷貝到myimage里
gc.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(iWidth, iHeight));
//this.BackgroundImage = img;
//保存位圖
img.Save(@"C:\" + Guid.NewGuid().ToString() + ".jpg");