How do I convert a WPF window to a bitmap?

♀尐吖头ヾ 提交于 2019-12-13 04:27:55

问题


I want to take screen shots of all the windows associated with an application and allow the user to edit them. I am not sure how to convert a window to a bitmap image though.

I want to do something like this...

WindowCollection handles = Application.Current.Windows;
List<Image> windowList = new List<Image>();
foreach (Window window in handles)
{
do something here to turn each window into a bitmap
windowList.Add(bitmapFromWindow)
}

I have found related questions, but nothing that answers my question. If you find any related resources please post.


回答1:


You can use RenderTargetBitmap

or have a look at that one:

http://blogs.msdn.com/b/swick/archive/2007/12/02/rendering-ink-and-image-to-a-bitmap-using-wpf.aspx



来源:https://stackoverflow.com/questions/20683542/how-do-i-convert-a-wpf-window-to-a-bitmap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!