我有一个 mdi 应用程序。我在父级上有一些链接,当单击时打开一个新的子表单并隐藏已经打开的表单 如何检查孩子是否已经打开?
A little scenario:
link 1 -> opens Child of type A
link 2 -> opens Child of type B
link 3 -> open Child of type C
Application start:
click on link 1-> check if a child of type A is opened
- yes -> hides the current opened child and shows the A-type Child
- no: -> hides the current opened child and creates a new A-type child and shows it
click on link 2 -> check if a child of type B is opened
- yes -> hides the current opened child and shows the B-type Child
- no: -> hides the current opened child and creates a new A-type child and shows it
etc..
你能帮我一些代码吗?
谢谢...
更新:
像这样的东西?
foreach (Form aForm in this.MdiChildren)
{
aForm.Hide();
}
foreach (Form f in this.MdiChildren)
{
if (f.Name == "VizualizareArticol")
f.Show();
else
{
VizualizareArticol vv = new VizualizareArticol();
vv.MdiParent = this;
vv.StartPosition = FormStartPosition.Manual;
vv.Location = new Point(0, 0);
vv.Show();
}
}
但不起作用...