C#屏幕截屏

  1. public static Bitmap GetImgDesk()
  2. {
  3. Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;
  4. //获取屏幕分辨率
  5. int x_ = rect.Width;
  6. int y_ = rect.Height;
  7. //截屏
  8. Bitmap img = new Bitmap(x_, y_);
  9. Graphics g = Graphics.FromImage(img);
  10. g.CopyFromScreen(new Point(0, 0), new Point(0, 0), new Size(x_, y_));
  11. return img;
  12. }

你可能感兴趣的:(C#)