How do I capture the current screen as an image?

后端 未结 2 949
失恋的感觉
失恋的感觉 2020-12-29 17:07

I want to add the ability for the users to capture the current screen in my app and email it. I have a very non-technical user base so I need this to be as simple as possib

相关标签:
2条回答
  • 2020-12-29 18:04

    That post you linked is the right approach, they just made it very complex. You would want to use Graphics.CopyFromScreen.

    Rectangle bounds = this.Bounds;
    
    using(Bitmap ss = new Bitmap(bounds.Width, bounds.Height))
    using(Graphics g = Graphics.FromImage(ss))
    {
      g.CopyFromScreen(this.Location, Point.Empty, bounds.Size);
      ss.Save("test.jpg", ImageFormat.Jpeg);
    }
    
    0 讨论(0)
  • 2020-12-29 18:11

    Check the Graphics.CopyFromScreen method.

    0 讨论(0)
提交回复
热议问题