Click here to Skip to main content
13,254,754 members (50,707 online)
Click here to Skip to main content
Add your own
alternative version


252 bookmarked
Posted 11 May 2008

Visual Studio IDE like Dock Container

, 14 May 2009
Rate this:
Please Sign up or sign in to vote.
Free Windows dock container

Important Note

We intend to create a new release of this open source product at the end of the next month (June 28, 2009). Please send any bug you've found (or desired change request) at .

Thank you all for using this product.


This article describes how to use the free dock container library in your applications.
You can download the full source from here. The full documentation for the product can be accessed here.

Here is a image of the sample project of this application:



This user control is made in C# and allows docking child forms on Left, Right, Top, Bottom and Fill.
The dock is guided by dock guiders.

Using the Code

There are two important classes in this library: DockableToolWindow and DockContainer.

The DockableToolWindow is the base class for the tool windows.

The most important property from this class is AllowedDock. This property returns the allowed dock values for the tool window which specializes this class. By default, this property allows docking the tool window on all panels. Overriding this property can change the dock behavior of the tool window (for example can allow only dock left or right).

The DockContainer class is the user control which hosts the tool windows.

This control should be added to the main form and docked fill.
Then you can add forms to it using the AddToolWindow method. This method adds a tool window to be managed by dock container. The caller must show the form to make it visible.

private void ShowNewForm ()
   // Create a new instance of the child form.
   DockableToolWindow childForm = new DockableToolWindow ();

   // Add the form to the dock container
   _dockContainer1.AddToolWindow (childForm);

   // Show the form
   childForm.Show ();

The forms can be added and docked with a single call to the DockToolWindow method.

private void OnCreateNewToolWindowDockedLeft (object sender, EventArgs e)
   // Create a new instance of the child form.
   DockableToolWindow childForm = new DockableToolWindow ();

   // Add and dock the form in the left panel of the container
   _dockContainer1.DockToolWindow (childForm, zDockMode.Left);

   // Show the form
   childForm.Show ();

The tool windows can be undocked using the UndockToolWindow method. Here is a sample of how to un-dock the top level tool-window from the left panel and then move it to an arbitrary location:

DockableToolWindow toolWindow = _dockContainer.GetTopToolWindow(zDockMode.Left);
if (toolWindow != null)
   toolWindow.Location = new Point(300, 100);

It is important for the users of this library to use the MinimumSizeChanged event to enforce the minimum dimensions of the container form.

private void OnDockContainerMinSizeChanged (object sender, EventArgs e)
   int deltaX = Width  - _dockContainer1.Width;
   int deltaY = Height - _dockContainer1.Height;

   MinimumSize = new Size (
      _dockContainer1.MinimumSize.Width  + deltaX,
      _dockContainer1.MinimumSize.Height + deltaY);

Points of Interest

The full documentation of this product can be accessed at the site mentioned at the beginning of this article. Please contact us at for additional information.


  • First version of this product was released on 2008.05.07


This article, along with any associated source code and files, is licensed under A Public Domain dedication


About the Author

No Biography provided

You may also be interested in...

Comments and Discussions

GeneralRe: Redocking forms Pin
cromul4-Nov-08 11:28
membercromul4-Nov-08 11:28 
QuestionLinks not working Pin
morphias0@yahoo.com18-Aug-08 5:53
membermorphias0@yahoo.com18-Aug-08 5:53 
GeneralRe: Links not working Pin
cromul4-Nov-08 11:29
membercromul4-Nov-08 11:29 
GeneralOther MDI forms Pin
Greg Conely7-Jul-08 7:17
memberGreg Conely7-Jul-08 7:17 
So I have an application that has about 10 main forms, 6 "toolboxes" and about a dozen or more other helper forms (date selectors, etc...). I started using this control for my toolboxes, and love it.

I added your control, then changed my code to display my toolboxes as DockableToolWindows. I compiled and ran my application. The toolboxes worked great. But none of my other MDI windows would show up. No errors or nothing. I imagine that they are hidden within the MDI under the DockContainer D'Oh! | :doh: .

Once I took of the MDI parent\container for these other windows, they would show up, but as seperate windows all together, and not as MDI windows as I want. I have been working around some of it by adding these other forms as DockableToolWindow, but it is just not going to work. One of the main reasons is, on one form, the user can "Search for Client" which should popup a dialog that lets them search for a client. I cannot pop this up as a child form because I cannot add a top level control to my form that I have as a DockableToolWindow.

Can we get this fixed asap plz? Thanks much.
AnswerRe: Other MDI forms Pin
cromul7-Jul-08 9:41
membercromul7-Jul-08 9:41 
GeneralRe: Other MDI forms Pin
aiman6925-Aug-08 23:48
memberaiman6925-Aug-08 23:48 
Question"not always on top" Pin
AVXT4-Jul-08 7:46
memberAVXT4-Jul-08 7:46 
AnswerRe: "not always on top" Pin
cromul7-Jul-08 9:43
membercromul7-Jul-08 9:43 
GeneralDocumentation Pin
Angelo DeFusco30-Jun-08 18:48
memberAngelo DeFusco30-Jun-08 18:48 
AnswerRe: Documentation Pin
cromul1-Jul-08 22:58
membercromul1-Jul-08 22:58 
QuestionBug 1 and about 2 kind improvement programs Pin
seeper17-Jun-08 0:44
memberseeper17-Jun-08 0:44 
AnswerRe: Bug 1 and about 2 kind improvement programs Pin
cromul1-Jul-08 23:01
membercromul1-Jul-08 23:01 
QuestionTabButton TextRenderer problem Pin
el Golem7-Jun-08 9:35
memberel Golem7-Jun-08 9:35 
AnswerRe: TabButton TextRenderer problem Pin
cromul9-Jun-08 9:03
membercromul9-Jun-08 9:03 
GeneralRe: TabButton TextRenderer problem Pin
TimMcQueen29-Dec-08 8:37
memberTimMcQueen29-Dec-08 8:37 
AnswerRe: TabButton TextRenderer problem Pin
cromul15-Jan-09 13:55
membercromul15-Jan-09 13:55 
GeneralRe: TabButton TextRenderer problem Pin
strangeloop4-Jan-09 4:36
memberstrangeloop4-Jan-09 4:36 
AnswerRe: TabButton TextRenderer problem Pin
Kompiler17-Sep-09 2:29
memberKompiler17-Sep-09 2:29 
GeneralRe: TabButton TextRenderer problem Pin
nekimiro9-May-14 0:30
membernekimiro9-May-14 0:30 
GeneralDockStyle.Fill doesn´t work Pin
Michaelgor31-May-08 7:11
memberMichaelgor31-May-08 7:11 
GeneralRe: DockStyle.Fill doesn´t work Pin
cromul2-Jun-08 8:35
membercromul2-Jun-08 8:35 
GeneralRe: DockStyle.Fill doesn´t work Pin
Michaelgor2-Jun-08 9:06
memberMichaelgor2-Jun-08 9:06 
AnswerRe: DockStyle.Fill doesn´t work Pin
cromul2-Jun-08 11:49
membercromul2-Jun-08 11:49 
Generalpls provide demo Pin
Nitin Sawant29-May-08 19:43
memberNitin Sawant29-May-08 19:43 
GeneralRe: pls provide demo Pin
cromul30-May-08 8:45
membercromul30-May-08 8:45 
QuestionAdd controls to the DockToolWindow? Pin
gjconely29-May-08 9:12
membergjconely29-May-08 9:12 
AnswerRe: Add controls to the DockToolWindow? Pin
cromul29-May-08 10:24
membercromul29-May-08 10:24 
AnswerRe: Add controls to the DockToolWindow? Pin
aiman6926-Aug-08 0:06
memberaiman6926-Aug-08 0:06 
GeneralNot working in Vista Pin
muttok19-May-08 23:22
membermuttok19-May-08 23:22 
GeneralRe: Not working in Vista Pin
cromul20-May-08 11:31
membercromul20-May-08 11:31 
GeneralRe: Not working in Vista Pin
Member 143090822-May-08 22:03
memberMember 143090822-May-08 22:03 
AnswerRe: Not working in Vista Pin
cromul23-May-08 7:26
membercromul23-May-08 7:26 
QuestionBug?? Pin
stuempfig19-May-08 12:53
memberstuempfig19-May-08 12:53 
AnswerRe: Bug?? Pin
cromul20-May-08 11:21
membercromul20-May-08 11:21 
GeneralPLEASE add a demo!!!!!! [modified] Pin
Brad Bruce12-May-08 4:58
memberBrad Bruce12-May-08 4:58 
AnswerRe: PLEASE add a demo - demo exists in sources package Pin
cromul12-May-08 11:25
membercromul12-May-08 11:25 
GeneralRe: PLEASE add a demo - demo exists in sources package Pin
Brad Bruce12-May-08 15:46
memberBrad Bruce12-May-08 15:46 
AnswerRe: Pin
cromul13-May-08 8:30
membercromul13-May-08 8:30 
GeneralRe: Pin
Brad Bruce13-May-08 13:28
memberBrad Bruce13-May-08 13:28 
AnswerRe: Pin
cromul13-May-08 21:13
membercromul13-May-08 21:13 
GeneralRe: Pin
Brad Bruce14-May-08 12:59
memberBrad Bruce14-May-08 12:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171114.1 | Last Updated 14 May 2009
Article Copyright 2008 by Cristinel Mazarine
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid