wpf WindowsFormsHost is not visible when AllowsTransparency=“True”

孤者浪人 提交于 2019-12-10 21:07:59

问题


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

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?


回答1:


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

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.

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.



来源:https://stackoverflow.com/questions/4108531/wpf-windowsformshost-is-not-visible-when-allowstransparency-true

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!