The design is similar to the C# IDE, where you are able to dock the toolbox and various other panes, where you can see a preview rectangle and some icons while dragging the DockableForm around. These icons and the preview rectangle show you the different ways to drop your panel. To get the whole picture of what I'm doing to create a fully dockable panel, I have included a lot of pictures to demonstrate the whole logic behind the particular topic I'm covering. If this is your first visit to this series, I would really recommend to go through all the previous parts first. Why? Because each of the different parts include the full source code (up to that point), as well as some retrospective short explanations about the different topics covered already.
As mentioned earlier in former lessons, these articles are aimed at programmers who are relatively new to C# (currently reading a C# book, or did some small examples in C#), but also have an existing basic knowledge of programming, (for example, former Visual Basic programmers), and at those who want to learn about how to build your own usercontrols.
Docking to Center by inserting into a TabControl instead of adding to a SplitContainer.
As you remember, when docking the first DockablePanel, you always dock to the SplitControler. So, to dock the second one on a TabControl, you will need to perform the following steps:
- Remove the already docked DockablePanel from the SplitControler.
- Remove the SplitControler itself.
- Add a TabControl on the DockingControler.
- Add the original primordial DockablePanel to the TabControl.
- Add the new DockablePanel to the TabControl.
But, if you already have docked two DockablePanels to the DockingControler and will add an additional one, the same Docking method has to do the following.
- Add the new DockablePanel to the TabControl.
- Nothing else.