关闭所有子窗体
FormCollection form = Application.OpenForms;ArrayList slist = new ArrayList();
IEnumerator form1 = form.GetEnumerator();
while (form1.MoveNext()) {
Form ff = (Form)form1.Current;
if(ff!=this)
slist.Add(ff);
}
IEnumerator s = slist.GetEnumerator();
while (s.MoveNext())
{
Form f = (Form)s.Current;
f.Close();
}
为什么我这个代码把主窗体的也关闭了(它是在执行完这个代码后就马上去执行主窗体关闭的代码)