Click here to Skip to main content
13,297,513 members (52,173 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

GeneralExternal link cannot be accessed Pin
KudoShin27-May-15 1:15
memberKudoShin27-May-15 1:15 
QuestionAny way to not resize the main/filled dock when docking a side panel Pin
JudyCW26-Jun-13 19:56
memberJudyCW26-Jun-13 19:56 
QuestionIDE Like Tabbed Document. Pin
Ritesh Khatri4-Nov-12 1:17
memberRitesh Khatri4-Nov-12 1:17 
QuestionLove it Pin
stevecocks13-Sep-12 0:37
memberstevecocks13-Sep-12 0:37 
QuestionImprove tags Pin
Sergey Alexandrovich Kryukov22-Jun-12 16:58
mvpSergey Alexandrovich Kryukov22-Jun-12 16:58 
QuestionCrom.controls problem when moving windows Pin
olivier BALFOURIER14-Jun-12 22:02
memberolivier BALFOURIER14-Jun-12 22:02 
QuestionCan not download the source files.. Pin
leilifan11-Apr-12 17:04
memberleilifan11-Apr-12 17:04 
Questionmodification to childforms. Pin
pasupulety31-Jan-12 21:18
memberpasupulety31-Jan-12 21:18 
QuestionChanges to DockToolWindows . Pin
pasupulety31-Jan-12 21:12
memberpasupulety31-Jan-12 21:12 
GeneralMy vote of 5 Pin
VB_ Coder13-Jul-11 11:45
memberVB_ Coder13-Jul-11 11:45 
GeneralDock container with Textbox issues Pin
Chalcy12-May-11 2:17
memberChalcy12-May-11 2:17 
AnswerRightToLeft Not Work. Pin
Biyuk Sadeghi Lahijan28-Feb-11 5:27
memberBiyuk Sadeghi Lahijan28-Feb-11 5:27 
QuestionAdding Dockables at Design Editor? Pin
Barzille31-Dec-09 1:23
memberBarzille31-Dec-09 1:23 
GeneralVS2008 complains when I load the example project Pin
IvanBohannon26-Oct-09 4:55
memberIvanBohannon26-Oct-09 4:55 
GeneralMy vote of 1 Pin
smton13-Jul-09 13:51
membersmton13-Jul-09 13:51 
GeneralRe: My vote of 1 Pin
jaimi21-Jul-09 5:17
memberjaimi21-Jul-09 5:17 
GeneralRe: My vote of 1 Pin
Johnny J.31-May-10 3:27
memberJohnny J.31-May-10 3:27 
GeneralRe: My vote of 1 Pin
RugbyLeague10-May-12 5:16
memberRugbyLeague10-May-12 5:16 
GeneralBug - Text selection with mouse does not work Pin
Fredo5-Jun-09 1:59
memberFredo5-Jun-09 1:59 
GeneralSome questions Pin
LomionAcc20-May-09 7:03
memberLomionAcc20-May-09 7:03 
Could you explain some things for me?

1) If we dock window on whole client area, we can't do anything with it except close.
How to undock such windows?
2) When the window tabbed it have triangle button in his title, for what it?
Pushing the button don't give any reaction.
3) How to dock floating window?
4) How to tab window in another window (like in VS Solution Explorer and Class View)?

And a little tip:

If we create docked window and then undock it the triangle button,
the pin button and the close button still on the title until mouse move.
I think it's bug.

OS: Windows XP, SP2
IDE: Visual Studio 2008
Docking Control:
.NET 3.5

Thank You
GeneralRe: Some questions Pin
Ajunta17-Aug-09 1:43
memberAjunta17-Aug-09 1:43 
GeneralSome important issues with docking Pin
dpk_kbsht13-May-09 22:04
memberdpk_kbsht13-May-09 22:04 
AnswerRe: Some important issues with docking Pin
cromul14-May-09 9:26
membercromul14-May-09 9:26 
GeneralCompared with WeifenLuo's DockPanel Suite Pin
Pinx12-May-09 4:47
memberPinx12-May-09 4:47 
GeneralRe: Compared with WeifenLuo's DockPanel Suite Pin
vincezed9-Apr-11 4:21
membervincezed9-Apr-11 4:21 
GeneralRe: Compared with WeifenLuo's DockPanel Suite Pin
Pinx11-Apr-11 3:30
memberPinx11-Apr-11 3:30 
GeneralThe DockContainer class is the user control which host the tool windows. Pin
Iraticus9-May-09 7:38
memberIraticus9-May-09 7:38 
NewsRe: The DockContainer class is the user control which host the tool windows. Pin
cromul10-May-09 8:32
membercromul10-May-09 8:32 
GeneralEvents not triggering when you derive from DockableToolWindow Pin
JayKnobler22-Apr-09 20:00
memberJayKnobler22-Apr-09 20:00 
AnswerRe: Events not triggering when you derive from DockableToolWindow Pin
cromul24-Apr-09 3:18
membercromul24-Apr-09 3:18 
QuestionI need a Help in your control Pin
tusharcapoor4-Feb-09 22:16
membertusharcapoor4-Feb-09 22:16 
GeneralDock My Form Pin
canci18-Dec-08 8:45
membercanci18-Dec-08 8:45 
AnswerRe: Dock My Form Pin
cromul19-Dec-08 6:20
membercromul19-Dec-08 6:20 
AnswerRe: Dock My Form Pin
AntonioElVampiro13-Jan-09 13:36
memberAntonioElVampiro13-Jan-09 13:36 
GeneralRe: Dock My Form [modified] Pin
joeller9-Apr-09 7:28
memberjoeller9-Apr-09 7:28 
GeneralRe: Dock My Form Pin
joeller9-Apr-09 11:26
memberjoeller9-Apr-09 11:26 
GeneralVista Bug not showing hide buttons Pin
grahamdodd27-Nov-08 15:18
membergrahamdodd27-Nov-08 15:18 
GeneralRe: Vista Bug not showing hide buttons Pin
cromul1-Dec-08 2:26
membercromul1-Dec-08 2:26 
GeneralRe: Vista Bug not showing hide buttons Pin
nymrin28-Jan-09 13:12
membernymrin28-Jan-09 13:12 
GeneralRe: Vista Bug not showing hide buttons Pin
nymrin28-Jan-09 13:40
membernymrin28-Jan-09 13:40 
QuestionActive Window Pin
ambarishtv28-Aug-08 19:46
memberambarishtv28-Aug-08 19:46 
AnswerRe: Active Window Pin
cromul4-Nov-08 11:27
membercromul4-Nov-08 11:27 
GeneralRedocking forms Pin
aiman6926-Aug-08 0:10
memberaiman6926-Aug-08 0:10 
GeneralRe: Redocking forms Pin
gjconely23-Oct-08 7:38
membergjconely23-Oct-08 7:38 
GeneralRe: Redocking forms Pin
cromul4-Nov-08 11:26
membercromul4-Nov-08 11:26 
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 
AnswerRe: Other MDI forms Pin
cromul7-Jul-08 9:41
membercromul7-Jul-08 9:41 

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