首页 > 代码库 > asp.net获取屏幕截图、活动窗口截图

asp.net获取屏幕截图、活动窗口截图

  1. Rectangle R = System.Windows.Forms.Screen.PrimaryScreen.Bounds;//获取活动窗口截图
  2. //Rectangle R = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;//获取整个屏幕截图
  3. System.Drawing.Image img = new Bitmap(R.Width, R.Height);
  4. Graphics G = Graphics.FromImage(img);
  5. G.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(R.Width, R.Height));
  6. IntPtr dc = G.GetHdc();
  7. G.ReleaseHdc(dc);
  8. G.Dispose();
  9. img .Save("c:\\a.jpg");