views:

504

answers:

1

Is it a good idea to place controls on the background of an MID parent window? I've added a split container to the MDI window which displays as expected however when I try to open any other forms in the same window they show BEHIND the SplitContainer. The only way to get them to popup is if I use ShowDialog to display them. Unfortunately I need to be able to have multiple windows open at once so this is not a practical solution.

Have I approached this the wrong way?

+1  A: 

You can't add any controls that cover the MDI client window (dark-gray background). MDI clients are shown with the client window as the parent so they'll have a Z-order lower than the control.

WF does support docked controls, it automatically adjusts the client area to the remaining space in the parent form. But that's about it, SplitContainer can't work.

Do note that you can show a forms on the panels of a SplitContainer. Set their TopLevel property to False so they turn into controls. For example:

  public partial class Form1 : Form {
    public Form1() {
      InitializeComponent();
      Form2 f2 = new Form2();
      f2.TopLevel = false;
      f2.FormBorderStyle = FormBorderStyle.None;
      f2.Visible = true;
      splitContainer1.Panel1.Controls.Add(f2);
    }
  }
Hans Passant