问题
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