private void Form1_Load(object sender, EventArgs e) { // store the result in a class-scoped variable // if you need to change the color again, or // whatever // // note that here we assume the Form IsMdiContainer property is 'true; // no checking that is true // this.Controls.OfType<MdiClient>().First().BackColor = Color.Red; // // }
foreach (Control c in this.Controls) { if (c is MdiClient) { c.BackColor = Color.Blue; break; } }
foreach (Control control in Controls) { MdiClient client = control as MdiClient; if (client != null) { client.BackColor = Color.Red; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)