Is it possible to change the background of the MDI window, and if so, how to do it with the built-in .NET tools?

  • one
    Child form, or parental yet? - BlackWitcher

2 answers 2

foreach (Control control in this.Controls) { if (control is MdiClient) { control.BackColor = Color.LightGreen; break; } } 

    Microsoft advises to do so (C # code): In the OnLoad handler OnLoad main form, type:

     MdiClient ctlMDI; foreach (Control ctl in this.Controls) { try { ctlMDI = (MdiClient) ctl; //Устанавливаем цвет дочерней формы таким же, как и у главной: ctlMDI.BackColor = this.BackColor; } catch (InvalidCastException exc) { //Обработка ошибок. } } // Создаем и Показываем дочернюю форму:п Form2 frm = new Form2(); frm.MdiParent = this; frm.Show(); 
    • one
      try-catch instead of if-as :( - Qwertiy