Click here to Skip to main content
13,558,821 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


252 bookmarked
Posted 11 May 2008
Licenced Public Domain

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

GeneralVista Bug not showing hide buttons Pin
grahamdodd27-Nov-08 14:18
membergrahamdodd27-Nov-08 14:18 
GeneralRe: Vista Bug not showing hide buttons Pin
cromul1-Dec-08 1:26
membercromul1-Dec-08 1:26 
GeneralRe: Vista Bug not showing hide buttons Pin
nymrin28-Jan-09 12:12
membernymrin28-Jan-09 12:12 
GeneralRe: Vista Bug not showing hide buttons Pin
nymrin28-Jan-09 12:40
membernymrin28-Jan-09 12:40 
QuestionActive Window Pin
ambarishtv28-Aug-08 18:46
memberambarishtv28-Aug-08 18:46 
AnswerRe: Active Window Pin
cromul4-Nov-08 10:27
membercromul4-Nov-08 10:27 
GeneralRedocking forms Pin
aiman6925-Aug-08 23:10
memberaiman6925-Aug-08 23:10 
GeneralRe: Redocking forms Pin
gjconely23-Oct-08 6:38
membergjconely23-Oct-08 6:38 
I get the same thing to happen. I have an MDI form, which I added the DockContainer to. Then I added some toolboxes that I want to be able to have moved around, hidden, shown, etc... to it. I got like four of them right now. Anyhow, they start up fine, and are docked to the bottom (so they are tabbed). Then, I click on the little PushPin (which should autohide them??) but it just shrinks the toolbar to about 1/2 the height, and it gets stuck there. I can't resize or nothing. The only thing I can then do to the window is move it around.

Here is the Code that I use to create the toolbox windows:
twTasks = New Crom.Controls.DockableToolWindow
Me.pnlTasks.Parent = twTasks
pnlTasks.Dock = DockStyle.Fill
Me.pnlTasks.Visible = True
twTasks.MinimumSize = pnlTasks.MinimumSize
twTasks.HideInsteadClosing = True
twTasks.Text = "Task List"
twTasks.Tag = "Tasks"
AddHandler twTasks.VisibleChanged, AddressOf HandleToolWindowVisibility

Greg Conely

GeneralRe: Redocking forms Pin
cromul4-Nov-08 10:26
membercromul4-Nov-08 10:26 
GeneralRe: Redocking forms Pin
cromul4-Nov-08 10:28
membercromul4-Nov-08 10:28 
QuestionLinks not working Pin
morphias0@yahoo.com18-Aug-08 4:53
membermorphias0@yahoo.com18-Aug-08 4:53 
GeneralRe: Links not working Pin
cromul4-Nov-08 10:29
membercromul4-Nov-08 10:29 
GeneralOther MDI forms Pin
Greg Conely7-Jul-08 6:17
memberGreg Conely7-Jul-08 6:17 
AnswerRe: Other MDI forms Pin
cromul7-Jul-08 8:41
membercromul7-Jul-08 8:41 
GeneralRe: Other MDI forms Pin
aiman6925-Aug-08 22:48
memberaiman6925-Aug-08 22:48 
Question"not always on top" Pin
AVXT4-Jul-08 6:46
memberAVXT4-Jul-08 6:46 
AnswerRe: "not always on top" Pin
cromul7-Jul-08 8:43
membercromul7-Jul-08 8:43 
GeneralDocumentation Pin
Angelo DeFusco30-Jun-08 17:48
memberAngelo DeFusco30-Jun-08 17:48 
AnswerRe: Documentation Pin
cromul1-Jul-08 21:58
membercromul1-Jul-08 21:58 
QuestionBug 1 and about 2 kind improvement programs Pin
seeper16-Jun-08 23:44
memberseeper16-Jun-08 23:44 
AnswerRe: Bug 1 and about 2 kind improvement programs Pin
cromul1-Jul-08 22:01
membercromul1-Jul-08 22:01 
QuestionTabButton TextRenderer problem Pin
el Golem7-Jun-08 8:35
memberel Golem7-Jun-08 8:35 
AnswerRe: TabButton TextRenderer problem Pin
cromul9-Jun-08 8:03
membercromul9-Jun-08 8:03 
GeneralRe: TabButton TextRenderer problem Pin
TimMcQueen29-Dec-08 7:37
memberTimMcQueen29-Dec-08 7:37 
AnswerRe: TabButton TextRenderer problem Pin
cromul15-Jan-09 12:55
membercromul15-Jan-09 12:55 

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
Web02 | 2.8.180515.1 | Last Updated 14 May 2009
Article Copyright 2008 by Cristinel Mazarine
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid