GlassWindow,UserControl和DirectX [英] GlassWindow, UserControl, and DirectX

查看:107
本文介绍了GlassWindow,UserControl和DirectX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这里的项目是WPF,主shell使用GlassWindow外观,意味着AllowTransparency属性设置为true。

问题这个属性是它与DirectX不太合适。

我们的应用程序内部有一个用户控件,在用户控件内部我们显示流式视频。



用户控件无法在内部控制透明度。 AllowTransparency属性必须与带句柄的窗口相关。



如何让用户控制忽略透明度?



谢谢

Hi
The project here is in WPF and the main shell is using GlassWindow appearance, meaning AllowTransparency property is set to true.
The problem with this property is that it doesn`t go well with DirectX.
We have a user control inside our app and inside that user control we display streaming video.

The user control cannot internally control the transparency. The property AllowTransparency must relate to a window with a handle.

How can I make the user control ignore the transparency?

Thanks

推荐答案

好吧,显然你的请求没有解决方法。

就你的控件托管而言WPF窗口,所以它完全由父对象控制。

如果我们从互操作机制看你的问题,我们可以得出结论,在WPF中只有一个 HWND (窗口'来自 WIN32 API 术语的句柄),因此视频ctrl的透明度取决于主窗口..

还有一个用于更具吸引力的单词看看MS说的话:

操作系统无法在没有对其内核引用HWND的情况下呈现任何对象。因此WPF就是这种情况。所以 WPF 窗口实际上包含对一个窗口句柄的引用。即使你可以获得任何Visual内部的Window Handle e WPF窗口



所以作为rusult - > WPF的每个Visual都没有与之关联的 HANDLE ,而是外部窗口元素的内容。因此可以说,每个WPF控件都归其所有。父窗口。
Well, obviously there is no workaround on your request.
As far as your control is hosted in WPF window , so it fully controlling by parent object.
If we look at your problem from interop mechanism , we can conclude that in WPF there is only one HWND (window''s handle from WIN32 API terminology) for all childs control, so as a result transparency of your video ctrl is dependant from main Window..
And one more for more compelling words look what MS said:
"OS cannot render any object without having a reference to HWND to its kernel. Hence is the case with WPF. So WPF window actually holds a reference to one window handle. Even you can get Window Handle for any Visual inside the WPF window"

So as a rusult -> Every Visual of WPF does not have its own HANDLE associated with it, rather it is a content for the outside window element, Hence you can say, every WPF control is owned by its parent window.


这篇关于GlassWindow,UserControl和DirectX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆