如何使用Mdi容器
当我想从 ToolStripMenu 打开新表单时,我通常会这样做
private void alumnoToolStripMenuItem_Click(object sender, EventArgs e)
{
frmAlumno x = new frmAlumno();
x.ShowDialog();
}
,但老师告诉我这是错误的,因为这不应该发生..
所以我想我必须使用 MdiContainer 但我现在不知道如何编写代码...请一些帮助...
This is what I usually do when I want to open a new form from a ToolStripMenu
private void alumnoToolStripMenuItem_Click(object sender, EventArgs e)
{
frmAlumno x = new frmAlumno();
x.ShowDialog();
}
but a teacher told me that it´s wrong because this shouldn´t happen..
So I guess I have to use MdiContainer but I´m not sure of how to write the code now... Please some help...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用MDI,您应该调用
Show
,而不是ShowDialog
。您还需要设置MdiParent
。如何:创建 MDI 子表单
If you use MDI, you should call
Show
, notShowDialog
. Also you need to setMdiParent
.How to: Create MDI Child Forms
我将回答您实际问题的解决方案,而不是描述如何使用 MdiContainer,因为您实际上并不需要它。 :)
表单有一个
ShowInTaskbar
属性,默认为true
。将其设置为false
,表单将不再出现在任务栏中。有关详细信息,请参阅 MSDN。
I'm going to answer with a solution to your actual problem instead of describing how to use MdiContainer, since you don't actually need it. :)
Forms have a
ShowInTaskbar
property that defaults totrue
. Set it tofalse
and the form will no longer appear in the task bar.See MSDN for more information.
C# 的 MDI 表单简介
Introduction to MDI Forms with C#