当AllowsTransparency ="True"时,wpf WindowsFormsHost不可见. [英] wpf WindowsFormsHost is not visible when AllowsTransparency="True"

查看:662
本文介绍了当AllowsTransparency ="True"时,wpf WindowsFormsHost不可见.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人在这里解决了此问题

somebody addressed this issue here http://social.msdn.microsoft.com/forums/en-US/wpf/thread/6f9dd3b5-af92-4076-9b4e-1a770dd52f70/

但是那是在2006年.我目前正在使用.net Framework 3.5.现在有没有更好的解决方案.有人知道Microsoft是否在4.0中对此问题有直接的解决方案?

but that was in 2006. i am currently using .net framework 3.5. Is there any better solution for that now. Does anybody know if microsoft has a straight forward solution for this issue in 4.0?

推荐答案

是的,这是行不通的.从链接

Yes, this won't work. Quote from this link

这是使用的限制 WS_EX_LAYERED和 UpdateLayeredWindow().这种形式的 分层窗口不支持子级 视窗.这是Win32的限制, 不是WPF限制.子窗 可以在不透明的情况下使用 (WS_EX_LAYERED和 SetLayeredWindowAttributes),但使用WPF 不支持该模式,因为它是 限制性更强(恒定与 每像素的不透明度).

This is a limitation of using WS_EX_LAYERED and UpdateLayeredWindow(). This form of layered windows does not support child windows. This is a Win32 limitation, not a WPF limitation. Child windows could be used with constant opacity (WS_EX_LAYERED and SetLayeredWindowAttributes) but WPF does not support that mode, as it is more restrictive (constant versus per-pixel opacity).

我能够找到的最佳解决方案是来自

The best solution I've been able to find was from this link.

在尝试时,我将System.Windows.Forms.TextBox添加到AllowsTransparency窗口中,您可以从此处.

I added a System.Windows.Forms.TextBox to the AllowsTransparency Window when I was trying it out, you can download my modified version of it from here.

这篇关于当AllowsTransparency ="True"时,wpf WindowsFormsHost不可见.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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