简体   繁体   English

将WPF窗口渲染为位图

[英]Render WPF-Window to Bitmap

I've created an WPF based application showing me thumbnails of external windows. 我创建了一个基于WPF的应用程序,向我显示了外部窗口的缩略图。 As an example i pick up icq, firefox and some other windows, create thumbnails of these and render them onto my WPF based application. 作为示例,我选择了icq,firefox和其他一些窗口,创建了这些缩略图的缩略图并将它们渲染到基于WPF的应用程序中。 That works fine already and looks like this: http://img560.imageshack.us/img560/1170/oijoijio.jpg (Just showing one thumbnail in here, but there will be multiple in future) 那已经很好用了,看起来像这样: http : //img560.imageshack.us/img560/1170/oijoijio.jpg (在这里只显示一个缩略图,但是将来会有多个)

The WPF application will also contain some controls to actually select the windows being "thumbnailed" and a few others. WPF应用程序还将包含一些控件,用于实际选择“已标记”的窗口以及其他一些控件。

The next step and my actual question is about how i would redirect these content being rendered into a Bitmap instead of the "WPF window" itself. 下一步和我的实际问题是有关如何将这些呈现的内容重定向到位图而不是“ WPF窗口”本身的问题。 Is there a way to accomblish that goal? 有没有办法实现这个目标? All the windows content (WPF containers and the drawn thumbnails) need to be rendered into a bitmap which i can display in directx window being owned by a game. 所有Windows内容(WPF容器和绘制的缩略图)都需要渲染为位图,我可以在游戏拥有的DirectX窗口中显示该位图。

I know that it is possible todo that somehow, as a programm called overwolf also uses WPF inside of their application. 我知道这样做是有可能的,因为名为overwolf的程序也在其应用程序内部使用WPF。 They actually install device inline detours to hook into the rendering process of the game, where they render their wpf content. 他们实际上安装了设备内嵌弯路,以挂接到游戏的渲染过程中,在那里渲染其wpf内容。 I am not sure if they use some kind of bitmap they render in there, or if they directly render the wpf content onto the dx-surface somehow. 我不确定他们是否使用在其中渲染的某种位图,或者是否以某种方式将wpf内容直接渲染到dx曲面上。

Other ideas besides the bitmap based style i plan to go for are welcome aswell! 除了我打算采用的基于位图的样式外,其他想法也很受欢迎! Thanks for your reading until here, and another big hug for any answer :) 感谢您的阅读,直到这里,以及任何其他答案的巨大拥抱:)

可以使用RenderTargetBitmap将任何WPF Visual对象渲染为位图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM