private void lblChangeText_Click(object sender, EventArgs e) { foreach (Control FontControl in this.Controls) { FontControl.Font = Sans; if (FontControl.GetType() == typeof(ListBox)) { FontControl.Font = Sans; } else if (FontControl.GetType() == typeof(Button)) { FontControl.Font = Sans; } } }
private void lbl1_Click(object sender, EventArgs e) { foreach (Control FontControl in this.Controls) { if (FontControl.GetType() == typeof(Label)) { FontControl.BackColor = Color.DarkCyan; FontControl.ForeColor = Color.Gainsboro; Font = Sans; } else if (FontControl.GetType() == typeof(Button)) { FontControl.BackColor = Color.White; FontControl.ForeColor = Color.Goldenrod; Font = Sans; } } }