在wpf中使用WinForm的控件有时候倒是很方便,特别是要使用ActiveX控件的时候必须把它封装成WinForm的控件才能使用,但使用的时候有诸多限制。这两天想在WPF窗口中使用一下WinForm的WebBrowser控件,但是一设置AllowsTransparency="True"属性,那个WebBrowser控件影都没有了,辛苦了两天去找原因,找方法,恍然间看到下面这段话。
抄一段《Programming Windows Presentation Foundation》上面的话,
WindowsFormsHost cannot be rotated, scaled, or skewed by a transform.
WindowsFormsHost supports only Opacity = 100% and can be contained only within other elements that are Opacity = 100%.
WindowsFormsHost will appear on top of other WPF elements in the same top-level window, although menus, ToolTips, and combo-box drop-downs are separate top-level windows and should work fine with WindowsFormsHost.
WindowsFormsHost does not respect the clipping region of its parent UIElement.
While the mouse is over the WindowsFormsHost, you won't receive WPF mouse events, and WPF's IsMouseOver property will return false