List<string> openFrom = new List<string>();
if (Application.OpenForms.Count > 2)
{
string result = string.Empty;
for (int i = 0; i < Application.OpenForms.Count; i++)
{
openFrom.Add(Application.OpenForms[i].GetType().ToString());
}
openFrom.Remove("system.WindowForm1");
openFrom.Remove("system.WindowForm2");
for (int i = 0; i < openFrom.Count; i++)
{
result += openFrom[i] + " $$ ";
}
if(openFrom.Count > 0)
{
return "请先关闭打开的窗体" + result;
}
}