Search code examples
c#formsmdiparentmdichild

LayoutMDI all but one child form


I have an MDI Application and have a sort of menu that has been created using a child form so it stays within the parents window. What I would like is when I call LayoutMDI (or some variation) for all but this form to be cascaded, tiled ect but I can't seem to find a way to do it.

I have tried overriding the LayoutMDI but that is not allowed (it's not virtual) and I can't seem to slap an if statement anywhere to exclude one window.

Any ideas?

Thanks.


Solution

  • I suggest that you change your code to;

    form.TopLevel=false;
    form.Parent=this;
    
    form.Show();
    

    Hopefully this should resolve your problem.