using System.Runtime.InteropServices;
[DllImport("user32.dll")]
private static extern int GetSystemMetrics(int index);
//取得螢幕解析度(w:寬 , h:高)
int w = GetSystemMetrics(0);
int h = GetSystemMetrics(1);
//建立畫布
Bitmap bmp = new Bitmap(w, h);
Graphics gh = Graphics .FromImage(bmp);
//取得螢幕畫面( 畫面將填入bmp中)
gh.CopyFromScreen(0, 0, 0, 0, new Size(w,h), CopyPixelOperation.SourceCopy);