Search code examples
c#winformsuser-controlswindowself-contained

User Control that acts like a standard Window, only confined to a pane


I'm making a program to generate code for me, and I'm fashioning the UI after Game Maker due to how easy the interface is. It has a SplitContainer with Panel1 containing a TreeView and Panel2 containing an arbitrary amount of self-contained windows (real windows, not some hacky workaround). I wanted to use user-controls to store the controls I use to modify things, but I can't figure out any way to put it in a window inside the splitContainer's Panel2. Can anyone help me?

Here's a good example:

https://i.sstatic.net/CG6kO.png

Those two sprite property windows are what I'm trying to do.


Solution

  • You could try using an MDI form and to implement your TreeView control, check out some sort of docking panel. I've used this one in the past (http://sourceforge.net/projects/dockpanelsuite/).

    It is very flexible. You set up one of these dockpanel forms, docked to the left of your MDI form. It will always be "on top" and the user can resize it exactly like the splitter control on a form. If you like, it can also has an "autohide" feature which may or may not be desirable in your case.

    It can then contain you treeview, which can load all the MDI Child forms you like.

    You'll find you're not fighting how "Windows" really want to behave and things will run a lot more smoothly.