C# 检查MDI容器是否为空
我只是陷入了一个非常简单的境地,无法控制自己。我的问题是 如何检查我的父母是否包含子表单? 非常感谢您的帮助。您可以使用父窗体的属性 如果父窗体不包含任何MDI子窗体,则它将为C# 检查MDI容器是否为空,c#,winforms,C#,Winforms,我只是陷入了一个非常简单的境地,无法控制自己。我的问题是 如何检查我的父母是否包含子表单? 非常感谢您的帮助。您可以使用父窗体的属性 如果父窗体不包含任何MDI子窗体,则它将为null。您可以使用父窗体的属性 如果父项不包含任何MDI子表单,则将为null。有关问题的标题: int formCount = this.MdiChildren.Count(); \\ or .Length MessageBox.Show("I have " + formCount.ToString() + " chi
null
。您可以使用父窗体的属性
如果父项不包含任何MDI子表单,则将为
null
。有关问题的标题:
int formCount = this.MdiChildren.Count(); \\ or .Length
MessageBox.Show("I have " + formCount.ToString() + " child forms open.");
Form2 f2 = new Form2();
f2.MdiParent = this;
f2.Show();
if (this.MdiChildren.Contains(f2))
MessageBox.Show("Form2 f2 is opened");
关于你问题的另一部分:
int formCount = this.MdiChildren.Count(); \\ or .Length
MessageBox.Show("I have " + formCount.ToString() + " child forms open.");
Form2 f2 = new Form2();
f2.MdiParent = this;
f2.Show();
if (this.MdiChildren.Contains(f2))
MessageBox.Show("Form2 f2 is opened");
关于你问题的标题:
int formCount = this.MdiChildren.Count(); \\ or .Length
MessageBox.Show("I have " + formCount.ToString() + " child forms open.");
Form2 f2 = new Form2();
f2.MdiParent = this;
f2.Show();
if (this.MdiChildren.Contains(f2))
MessageBox.Show("Form2 f2 is opened");
关于你问题的另一部分:
int formCount = this.MdiChildren.Count(); \\ or .Length
MessageBox.Show("I have " + formCount.ToString() + " child forms open.");
Form2 f2 = new Form2();
f2.MdiParent = this;
f2.Show();
if (this.MdiChildren.Contains(f2))
MessageBox.Show("Form2 f2 is opened");