c# – 如何让WinForms表单在AvalonDock中作为DockableContent工作?
作者:互联网
我可以使用WinForms控件,但不能使用整个表单:
var foo = new DockableContent();
foo.Title = "Foo";
foo.Name = "FooName";
var c = new WindowsAppFramework.RenderTargetUserControl();
c.Dock = System.Windows.Forms.DockStyle.Fill;
c.AutomaticUpdateFPS = 60;
var host = new System.Windows.Forms.Integration.WindowsFormsHost();
host.Child = c;
foo.Content = host;
foo.ShowAsDocument(dockManager);
foo.Focus();
是否可以使用整个表格?我想在应用程序中使用现有的表单.
解决方法:
您可以将表单转换为子控件:
var frm = new Form1();
frm.TopLevel = false;
frm.Visible = true;
frm.FormBorderStyle = FormBorderStyle.None;
这基本上把它变成了UserControl.
标签:c,winforms,wpf,avalondock,winforms-interop 来源: https://codeday.me/bug/20190526/1158514.html