一、wpf项目中引用WindowsFormsIntegration和System.Windows.Forms

二、Form1.Designer.cs 的 partial class Form1 设置为:public partial class Form1

三、代码如下:

XXXX.Form1 Zhuwindow = new XXXX.Form1();
            Zhuwindow.TopLevel = false;
            Zhuwindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            Host1.Child = Zhuwindow;

 

主要是代码: Zhuwindow.TopLevel = false; ,即可解决 WPF加载Winform窗体时 报错:子控件不能为顶级窗体 的问题。

相关文章:

  • 2021-11-01
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-26
  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
  • 2021-10-10
相关资源
相似解决方案