Question

I have got a control with a Splitcontainer added. I want to place another forms on the second panel (Panel2). However, it is not possible to set the MDIParent property of a brand new form to Panel2.

Thus, the question is - how can I set the SplitContainer's panel as the MDIParent for another controls?

Thank you in advance for the clues!

cheers

Was it helpful?

Solution

An MDIParent can only be another Form. What you need to do is set TopLevel to False on the child Form. Then you can add it to any control just like it was any other control (by adding it to the parent control's Controls collection). However, it won't work like it does in an MDI container (as in you won't be able to minimize or maximize it).

OTHER TIPS

If you want to make Panel-Splitter-MdiClient Form see panel and MDI in c#

If your intent is to use the splitcontainer to load different subforms this may help. Instead of using WinForms, you could use classes derived from panels containing all the widgets that a normal WinForm would have. To display them, simply add them to your splitcontainer's Panel2 controls collection.

Some events and methods to keep in mind are:

  • subformPanel.ParentChanged (do some initialization and subscribe to any parent events)
  • subformPanel.ParentChanged (do some cleaning up and unsubscribe to parent events)
  • Parent.Controls.Remove (destroy the subformPanel)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top