简体   繁体   English

如何在AvalonDock中使WinForms Form作为DockableContent工作?

[英]How can I make a WinForms Form work as a DockableContent in AvalonDock?

I am able to use WinForms controls, but not an entire form: 我可以使用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();

Is it possible to use an entire Form? 是否可以使用整个表格? I want to make use of existing Forms in the Application. 我想利用应用程序中的现有表格。

You can turn a form into a child control: 您可以将表单变成子控件:

  var frm = new Form1();
  frm.TopLevel = false;
  frm.Visible = true;
  frm.FormBorderStyle = FormBorderStyle.None;

Which essentially turns it into a UserControl. 实质上将其转换为UserControl。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AvalonDock-将MenuItem绑定到DockableContent的状态 - AvalonDock - Bind MenuItem to State of DockableContent 如何让Winforms表单终止应用程序? - How can I make a Winforms form terminate the application? 在 AvalonDock 中,我如何确定布局是否“脏” - In AvalonDock how can I determine if the layout “is dirty” avalondock 如何以编程方式绑定 Title、IsSelected 等属性 - avalondock how I can programmatically bind the Title, IsSelected, etc, property 如何在.net Winforms中的运行时上更快地在窗体上创建图片框? - How can i make pictureboxe on the form more fastly on runtime in .net winforms? 我怎么能这样做,当我单击form2上的按钮时,它会影响form1(C#)Winforms上的richtextbox? - How can I make it so that when I click a button on form2, it affects a richtextbox on form1 (C#) Winforms? 如何基于构建配置(调试/发布)制作具有不同表单(GUI)元素的C#/ Winforms应用程序? - How can I make a C#/Winforms application that has different form (GUI) elements based on build configuration (Debug/Release)? 如何在C#中拍摄Winforms控件/窗体的屏幕截图? - How can I take a screenshot of a Winforms control/form in C#? 如何在不单击它的情况下触发表单上的默认按钮(winforms)? - How can I trigger the default button on a form without clicking it (winforms)? 在winforms中,如何使控件不接受鼠标事件 - in winforms, how can i make a control not accept mouse events
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM