我有两个小问题要问您:如何在 C# 中将多个子表单添加到表单中,如下图所示:
[级联]
[瓦]
第二个是如何管理他们的位置(Cascade、Tile 等)。感谢您的时间!
This is a Multiple Document Interface (MDI) form but, as Robert Harvey mentioned in a comment, there's probably a better way to build your UI.
To layout the child forms you will use the LayoutMdi method of the parent.
It's called MDI (Multiple Document Interface). To do that, you need to change the IsMdiContainer
property of the MainForm to true
. And then you need to change the MdiParent
property of the child Forms to your MainForm instance.
You can have a method in your MainForm class like:
public void MakeChildForm(Form childForm)
{
childForm.MdiParent = this;
}