How to make windows form take up all the space within the MDI application?

Asked

Viewed 92 times

-1

I am creating a registration and management system that works only with CRUD. The whole functional part of the system is working perfectly, but there’s something that’s been bothering me. I’m using MDI application, in this case when I click on the top menu, it creates smaller windows within the application, making the long-term mess.

My object is simply to do the following: Click on the top menu, and windows form take up 100% of MDI space. Just like when you click on another menu, close the current windows form and create the other grabbing the entire screen size. Can anyone tell me how to do this?

  • 2

    But then what’s the point of using an MDI window?

  • My goal is to manage the application windows. And by the way, I figured out how to use it at 100%, in case it just goes in formBorderStyle, in the properties menu, and leave with value of "None", and also go in windowState and leave with value of "maximize". So when you click on the menu, it lets you occupy 100% of the space and no borders.

  • But I still do not know how to remove the minizar and maximize controls that exist for these windows (in the case inside the MDI appears these options when it is in 100% screen size), and also still do not know how to close this window when opening another through the menu. Can you help me with this?

1 answer

1

I found the solution.

To leave the Form with 100% inside an Mdi application, just go to the Form properties, configure formBorderStyle with "None" value, and also go to windowState and leave with "maximize" value. In addition it is also necessary to put the value in the Controlbox field to false.

And finally, to close any open Form inside Mdi, just use:

foreach (Form f in this.MdiChildren)
{
  f.Close();
}

By doing this, it closes open Forms, maximizes and disables minimize/maximize controls within Mdi.

This was my solution.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.