控件不会显示在Winforms Host上 [英] Controls don't show over Winforms Host

查看:125
本文介绍了控件不会显示在Winforms Host上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将SWF文件加载为WPF窗口的背景.为此,我使用了WinformHost,并使用插件AxShockwaveFlashObjects将swf电影加载到Winform主机中.

I am trying to load a swf file as background for my WPF window. For this I have used a WinformHost and I load the swf movie in the Winform host using the plugin AxShockwaveFlashObjects.

<Grid>
    <WindowsFormsHost Name="wfh">
        <ax:AxShockwaveFlash x:Name="axFlash"/>
    </WindowsFormsHost>
</Grid>

直到这里应用程序都可以正常工作.但是,当我将其他控件(按钮,文本块等)添加到网格时,它们不会显示.我所看到的只是电影.任何指针.

Till here the application works fine. However when I add my other controls(buttons,textblocks etc) to the Grid, they dont show. All I see is just the movie. Any pointers please.

推荐答案

这实际上是可以预期的,因为WPF元素都在单个HWND(在本例中为WPF窗口)内呈现,因此位于WindowsFormsHost下方(或任何其他HwndHost).在MS的此处中进行了讨论.文档以及此处.

This is actually expected since the WPF elements are all rendered within a single HWND (that of the WPF Window in this case) and therefore are below the WindowsFormsHost (or any other HwndHost). This is discussed here in MS' documentation and also here.

理论上,这将通过.a 4.5中的一些新功能来支持-通过这里.

In theory this will be supported by some new functionality being added to .NET 4.5 - via the IsRedirected property of the HwndHost. This is discussed in some of the preview documentation for 4.5 here.

这篇关于控件不会显示在Winforms Host上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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