【发布时间】:2014-11-07 10:13:16
【问题描述】:
现在我的任务是将 Windows 窗体面板添加到 WPF 窗口。 我使用默认模式运行,它运行正常,但是当我更改为 AllowTransparency=True 时,所有 Windows 窗体控件都消失了。
这是我在here之后向控件添加面板的代码
这里是源代码:
System.Windows.Forms.Panel myPanel = new System.Windows.Forms.Panel();
myPanel.BackColor = System.Drawing.Color.AliceBlue;
myPanel.Visible = true;
myPanel.Width = 500;
myPanel.Height = 500;
WindowsFormsHost myHost = new WindowsFormsHost();
myHost.Child = myPanel;
ui_aaa.Children.Clear();
ui_aaa.Children.Add(myHost);
ui_aaa.UpdateDefaultStyle();
我需要找到在 AllowTransparency 模式下显示面板的方法。谢谢
【问题讨论】:
-
WPF 使用每像素 Alpha 透明度。这与使用 24bpp GDI 渲染的旧版 Windows 控件非常不兼容,这些控件变得完全不可见。 WPF 中的标准“空域”问题之一。
-
感谢您的帮助。意思是当WPF中的Window设置AllowTransparency=true时,无法在WPF中加载Winforms控件,是不是