111,131
社区成员
发帖
与我相关
我的任务
分享
private void button2_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
}
// 是否已经打开了?(用循环来判断)
foreach (Form childrenForm in this.MdiChildren)
{
//检测是不是当前子窗体名称
if (childrenForm.Name == "子窗体名称")
{
//是的话就是把他显示
childrenForm.Visible = true;
//并激活该窗体
childrenForm.Activate();
return;
}
}
//下面是打开子窗体
CardAdmin myCardAdmin = new CardAdmin();
myCardAdmin.MdiParent = this;
myCardAdmin.Show();
myCardAdmin.WindowState = FormWindowState.Maximized;