Question

hello i am working on a small uni project. nad the problem is that when i click on a button it has to show a child form in a MDI Container.

but that isnt working. all the properties are set right.

the mdi container itself contains a splitcontainer and some buttons,text fields , labels etc.

the code to a button is as follows

    private void ChangeRecipe_Click(object sender, EventArgs e)
    {
        Form rec = new recipe();
        rec.MdiParent = this;
        rec.Show();
    }

this is how i am calling it but i dont see any forms being displayed inside or outside the container.

Was it helpful?

Solution

The window is there, you just can't see it. It is behind your SplitContainer.

MDI child windows are parented to the MDI client window, the dark gray window inside the parent. You cannot put any controls on the MDI parent unless you dock them to an edge. Which makes the MDI client window shrink and fit the remaining space. That pretty much kills the idea of using a splitter. No workaround for this, by design for MDI.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top