问题描述
我要添加到捕捉当前画面在我的应用程序,并通过电子邮件发送的能力,为用户。我有一个非常非技术用户群,所以我需要这是越简单越好。我打算让他们点击称为菜单项帮帮我吧!这将随后捕捉当前应用程序屏幕,希望能为JPG或PNG,然后打开Outlook并添加图像作为附件。
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 possible. I plan to let them click a menu item called Help Me! which will then capture the current Application Screen, hopefully as a jpg or png, and then open Outlook and add the image as an attachment.
我读通过这篇文章抓屏在code ++项目,但它是一个小老头,不正是我一直在寻找的,所以我想我会检查是否有这样做的更好的方法。
I was reading through this post ScreenCapture on Code Project but it is a little old and isn't exactly what I was looking for so I thought I would check if there is a better way of doing this.
我该如何开始呢?有一个库或者内置的足够的能力?
How do I get started on this? Is there a library or are the built in capabilities enough?
谢谢!
推荐答案
这后您链接是正确的做法,他们只是说得很复杂。您可能需要使用 图形。 CopyFromScreen
。
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);
}
这篇关于怎样捕捉当前画面的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!