http://www.tiantiansoft.com/bbs/dispbbs.asp?boardID=40&ID=80348
private bool HaveOpened(Form myMdi,string windowName)
{
//查看窗口是否已经被打开
bool bReturn=true;
for(int i=0;i<myMdi.MdiChildren.Length;i++)
{
//MessageBox.Show(myMdi.MdiChildren[i].Name);
if(myMdi.MdiChildren[i].Name==windowName)
{
myMdi.MdiChildren[i].BringToFront();
bReturn=false;
break;
}
}
return bReturn;
}
打开窗口的时候:
ProcessesManage w0=new ProcessesManage();
if(HaveOpened(myMdi,"ProcessesManage"))
{
w0.MdiParent=myMdi;
w0.Show();
}
这里的myMdi,是Form类型的,传递的是mdi窗口