转换窗口的形式为图片 [英] Convert windows form to a picture
问题描述
我环顾四周,我可能混淆谷歌的关键字。
I looked around and I may have confused google with the keywords.
我要寻找我的窗口来实现支持模块构成应用中,当用户点击一个按钮,电子邮件发送到支持团队,一个带有附件的截图(有关表格)
I am looking to implement a support module in my windows forms application where when a user clicks on a button, an email is sent to the support team, with an attachment of a screenshot (form in question)
我在寻找类似
form.SaveAsImage(路径)
form.SaveAsImage(path)
在任何想法如何能够实现或我错过了明显
any thoughts on how this can be implemented or have I missed the obvious
.NET 3.5
推荐答案
尝试使用<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.drawtobitmap.aspx">Control.DrawToBitmap方法,并确保该窗体有当您运行code对焦。
Try using the Control.DrawToBitmap method and make sure the form has focus when you run the code.
Graphics gfx = form.CreateGraphics();
Bitmap bmp = new Bitmap(form.Width, form.Height);
form.DrawToBitmap(bmp, new Rectangle(0, 0, form.Width, form.Height));
bmp.Save(fileName);
这篇关于转换窗口的形式为图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!