1
votes

I have an MDI container which allows a user to choose whether to have the form's children tile or cascade when they open. The user can choose this option through by click and checking an item in the menu. However, after checking the item and opening the form, they appear on top of one another instead of tiling or cascading. I've tried to call the layout method after opening the form [after dlg.Show() in the methods below] but it still does not produce proper layout.

Any ideas?

Menu Event Handlers

private void titledToolStripMenuItem_Click(object sender, EventArgs e)
    {
        cascadingToolStripMenuItem.Checked = false;
        this.LayoutMdi(MdiLayout.TileHorizontal);
    }

    private void cascadingToolStripMenuItem_Click(object sender, EventArgs e)
    {
        titledToolStripMenuItem.Checked = false;
        this.LayoutMdi(MdiLayout.Cascade);
    }

Form Open method

private void openTallChildToolStripMenuItem_Click(object sender, EventArgs e)
    {
        TallChild dlg = new TallChild(this.height);
        dlg.MdiParent = this;
        dlg.Show();

    }
2
Check dizzy.stackoverflow's Answer. If that doesn't help you then Show us the constructor and Form_Load of the Child form - user2509901

2 Answers

0
votes

This can happen when the child's FormBorderStyle is not set to Sizable.

Try:

dlg.FormBorderStyle = FormBorderStyle.Sizable;
0
votes

I had to put this.LayoutMdi into protected override void OnShown to get the layout working work https://stackoverflow.com/a/2836353/74585