Leron
Leron

Reputation: 9866

winforms MDI how to make a child form look like a natural part of the parent

The problem is this - I have a main form (parent) with a menu and several other forms which are children I want them to load in the main form. The problem that I met is - the child form is loaded within the main form(parent) but it looks like a separate window. This:

enter image description here

And it not only stays like window within a window but also don't get resized when the parent is which seems logical but is not what I want.

What I want is something like this :

enter image description here

I want the child forms to be loaded without the window controllers for minimize, maximize, close, the blue line and all that stuff but instead to look like a part of the parent window and respond to some parent events like resize.

Upvotes: 1

Views: 1392

Answers (1)

Eugene
Eugene

Reputation: 1535

Try adding the following code into your children windows (and subscribe on FormLoaded event)

private void FormLoad(object sender, EventArgs e)
{
    FormBorderStyle = FormBorderStyle.None;
    WindowState = FormWindowState.Maximized;
}

Upvotes: 2

Related Questions