Jan 6, 2009
I'm trying to make an MDI TabControl Container usercontrol, which is used instead of the MdiClient control in an MDI application. Instead of MDI Forms, you can use (modified) TabControls that behave like (maximized) MDI Forms in a Tabbed environment.
View 1 Replies
A great example is of course the Visual Studio IDE. Each window is just a TabPage on a TabControl (at least it looks like it is, I don't know exactly how it works in the IDE.. but let's assume it is).Now, the VS IDE uses some great functionality which I believe is called TabGroups. By Right-clicking (or dragging it into nothingness) a TabPage 'header', you can choose New Horizontal / Vertical Tab Group, which splits the 'container' into two TabControls, each with their own TabPages, with a splitter in between so you can resize them.
I have been trying to recreate this behaviour, and I must say it works pretty well so far for very little effort. The only (major) downside is, it only works for Vertical OR Horizontal TabGroups. I have no idea how I can possibly make it work using both vertical and horizontal TabGroups simultaneously...
What I did is pretty simple: I have a mdiTabControlContainer which is just a blank UserControl. I made a public property TabControls that returns a (custom) mdiTabControlCollection (inheriting from a generic Collection(Of mdiTabControl) which is basically just a collection of my tabcontrols.
When the collection is modified, I call a RedrawTabControls method which first clears the Controls (deletes all TabControls), and then adds them one by one. First the last in the collection (docked Fill) then the rest docked Left. I also add a splitter between each TabControl. (Code at the bottom)If I dock the TabControls to "Top" for example, I can make it Horizontal. But I have no idea how I can possibly dock a few of them to Left and the other few to Top...? I would need some kind of property that determines which TabControl should be docked where, right? But how and when would I set that property?
The code I'm using now is:
Public Class mdiTabControlContainer
Public Sub New()