gpt4 book ai didi

c# - 如何使用 MdiContainer

转载 作者:太空宇宙 更新时间:2023-11-03 19:28:54 24 4
gpt4 key购买 nike

当我想从 ToolStripMenu 打开一个新窗体时,我通常会这样做

private void alumnoToolStripMenuItem_Click(object sender, EventArgs e)
{
frmAlumno x = new frmAlumno();
x.ShowDialog();
}

但是一位老师告诉我这是错误的,因为这不应该发生..

Image

所以我想我必须使用 MdiContainer 但我现在不确定如何编写代码...请帮忙...

最佳答案

如果您使用 MDI,您应该调用 Show,而不是 ShowDialog。您还需要设置 MdiParent

Form2 newMDIChild = new Form2();

// Set the Parent Form of the Child window.
newMDIChild.MdiParent = this;

// Display the new form.
newMDIChild.Show();

How to: Create MDI Child Forms

关于c# - 如何使用 MdiContainer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6434335/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com