WPF窗口透明度,同时举办的Flash ActiveX组件 [英] WPF Window transparency while hosting a Flash ActiveX component

查看:184
本文介绍了WPF窗口透明度,同时举办的Flash ActiveX组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序有一个自定义窗口设计,这意味着每一个窗口都有设置以下参数(XAML):
WindowStyle =无
AllowsTransparency =FALSE

My application has a custom window design, which means that every window has the following parameters set (XAML): WindowStyle="None" AllowsTransparency="False"

一个子窗口的显示需要Flash组件时,Flash ActiveX组件托管thrugh XAML:


One of the sub windows needs to display a Flash component, the Flash ActiveX component is hosted thrugh XAML:

至于窗口的透明度,有一个已知问题WPF和托管的WinForms组成部分,它只是不工作的开箱。为了能够查看Flash组件,AllowsTransparency必须设置为假,否则,闪光组件将根本不被显示。

With regards to window transparency, there is a known issue with WPF and hosted winforms components, it just doesn't work out of the box. In order to be able to view the Flash component, AllowsTransparency must be set to "False", otherwise, the flash component will simply not be displayed.

要保持窗口的透明度(和一般的L&安培; F),我已经修改了这段代码:的 http://blogs.msdn.com/b/adam_nathan/archive/2006/05/04/589686.aspx

To maintain the window's transparency (and general L&F), I have modified this piece of code: http://blogs.msdn.com/b/adam_nathan/archive/2006/05/04/589686.aspx

        IntPtr hwnd = new WindowInteropHelper(window).Handle;

        // Set the background to transparent from both the WPF and Win32 perspectives
        window.Background = Brushes.Transparent;
        HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;

        MARGINS margins = new MARGINS(margin);
        DwmExtendFrameIntoClientArea(hwnd, ref margins);



所以一切都是现在的工作很好,直到我开始检查它的 XP 。显然,上述的一段代码不能在XP,因为使用的DLL(dwmapi.dll文件)是Vista的DLL工作。

So everything is now working great, until I started checking it on XP. Obviously, the above piece of code doesn't work on XP since the DLL used (dwmapi.dll) is a Vista DLL.

现在的问题是一样的结果是否能在XP中可以实现,如果是这样,怎么样?

The question is whether the same result can be achieved in XP and if so, how?

我试图改变这一段代码:的如何创建一个WPF半透明窗口,使鼠标事件通过或其他类似的例子,然而,我没能做到任何窗口的透明度。

I've tried altering this piece of code: How to create a semi transparent window in WPF that allows mouse events to pass through or similar other examples, yet, I didn't manage to achieve any window transparency.

将不胜感激的任何建议。

Would appreciate any advice.

推荐答案

我认为这是不可能做我想做的事情......我结束了在XP创建方窗,以避免与视觉问题的透明度。

I believe that it is not possible to do what i want to do... I ended up creating square windows on XP to avoid any transparency related visual issues.

这篇关于WPF窗口透明度,同时举办的Flash ActiveX组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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