private void loopOverFormsButton_Click(object sender, EventArgs e) { WODAApplicationForm waf = new WODAApplicationForm(); WODAMatchesForm wmf = new WODAMatchesForm(); waf.Show(); wmf.Show(); foreach (Form f in Application.OpenForms) { f.BackColor = Color.Plum; foreach (Control c in f.Controls) { c.BackColor = Color.Red; if (c is GroupBox) { foreach (Control d in c.Controls) { d.BackColor = Color.Blue; } } } } }
private void openCloseFormsButton_Click(object sender, EventArgs e) { WODAApplicationForm waf = new WODAApplicationForm(); WODAMatchesForm wmf = new WODAMatchesForm(); waf.Show(); wmf.Show(); for (int i = Application.OpenForms.Count - 1; i > 0; i--) { Application.OpenForms[i].Close(); } }