问题描述
有谁知道如何使用C#采取截图,并限制其采取的应用程序的特定容器/部分的图片。我不希望整个屏幕或应用程序的整个窗口。
Does anyone know how to take a screenshot using C# and limit it to take a picture of a specific container/portion of an application. I do not want the whole screen or whole window of the application.
我的面板被简称为:PANEL1用户可以点击一个按钮,并采取PANEL1的屏幕截图和附加到电子邮件。
My Panel is simply called: panel1User would click a "button" and take screenshot of panel1 and attach to email.
我想采取一个屏幕截图的那款只,然后在本地保存到C:\驱动器和/或连接或嵌入到Outlook电子邮件
I would like to take a screen shot of that section only and then save locally to the C:\ Drive and/or attach or embed into an outlook email.
我看了其他各种事情在互联网上,但他们大多不得不处理创造采取了Web浏览器控制,我不是在寻找的截图复杂的变化。
I read other various things on the internet but most of them had to deal with creating complex changes in take a screenshot of a web browser control which I am not looking for.
推荐答案
我这样做是使用类似
public static void TakeCroppedScreenShot(
string fileName, int x, int y, int width, int height, ImageFormat format)
{
Rectangle r = new Rectangle(x, y, width, height);
Bitmap bmp = new Bitmap(r.Width, r.Height, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(r.Left, r.Top, 0, 0, bmp.Size, CopyPixelOperation.SourceCopy);
bmp.Save(fileName, format);
}
我希望这有助于
I hope this helps
这篇关于C#采取.NET控件的屏幕截图中的应用,并连接到Outlook电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!