vb.net 在另一个表单中打开一个表单

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30110858/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 19:06:15  来源:igfitidea点击:

Opening a form, within another form

vb.netformswinformsvisual-studiovisual-studio-2013

提问by Uriahs Victor

I have seen applications where there is a main form...and forms that could be opened within the main's canvas but cannot be dragged out of the main form at all.But could be maximized while still remaining within the "main" form. I have googled this but everyone is just trying to open one form from another which is not what i want to do.

我见过有主窗体的应用程序......以及可以在主窗体中打开但根本无法从主窗体中拖出的窗体。但可以最大化同时仍保留在“主”窗体中。我已经用谷歌搜索了这个,但每个人都只是想从另一个表单中打开一个表单,这不是我想要做的。

回答by Ciper123

use an MDI Form, make the MDI Form your startup form, then to show the child form use the code below in the MDI Form's load event or any other event you want:

使用 MDI 表单,使 MDI 表单成为您的启动表单,然后在 MDI 表单的加载事件或您想要的任何其他事件中使用以下代码来显示子表单:

childform.MDIParent = Me
childform.Show()

and that's it :)

就是这样:)