Click here to Skip to main content
12,300,191 members (55,402 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


251 bookmarked

Visual Studio IDE like Dock Container

, 14 May 2009 Public Domain
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

AnswerRe: TabButton TextRenderer problem Pin
Kompiler17-Sep-09 1:29
memberKompiler17-Sep-09 1:29 
GeneralRe: TabButton TextRenderer problem Pin
nekimiro8-May-14 23:30
membernekimiro8-May-14 23:30 
GeneralDockStyle.Fill doesn´t work Pin
Michaelgor31-May-08 6:11
memberMichaelgor31-May-08 6:11 
GeneralRe: DockStyle.Fill doesn´t work Pin
cromul2-Jun-08 7:35
membercromul2-Jun-08 7:35 
GeneralRe: DockStyle.Fill doesn´t work Pin
Michaelgor2-Jun-08 8:06
memberMichaelgor2-Jun-08 8:06 
AnswerRe: DockStyle.Fill doesn´t work Pin
cromul2-Jun-08 10:49
membercromul2-Jun-08 10:49 
Generalpls provide demo Pin
Nitin Sawant29-May-08 18:43
memberNitin Sawant29-May-08 18:43 
GeneralRe: pls provide demo Pin
cromul30-May-08 7:45
membercromul30-May-08 7:45 
Demo application is provided in the sources package. To run the demo application you need to unzip the sources, open and run the solution.
QuestionAdd controls to the DockToolWindow? Pin
gjconely29-May-08 8:12
membergjconely29-May-08 8:12 
AnswerRe: Add controls to the DockToolWindow? Pin
cromul29-May-08 9:24
membercromul29-May-08 9:24 
AnswerRe: Add controls to the DockToolWindow? Pin
aiman6925-Aug-08 23:06
memberaiman6925-Aug-08 23:06 
GeneralNot working in Vista Pin
muttok19-May-08 22:22
membermuttok19-May-08 22:22 
GeneralRe: Not working in Vista Pin
cromul20-May-08 10:31
membercromul20-May-08 10:31 
GeneralRe: Not working in Vista Pin
Member 143090822-May-08 21:03
memberMember 143090822-May-08 21:03 
AnswerRe: Not working in Vista Pin
cromul23-May-08 6:26
membercromul23-May-08 6:26 
QuestionBug?? Pin
stuempfig19-May-08 11:53
memberstuempfig19-May-08 11:53 
AnswerRe: Bug?? Pin
cromul20-May-08 10:21
membercromul20-May-08 10:21 
GeneralPLEASE add a demo!!!!!! [modified] Pin
Brad Bruce12-May-08 3:58
memberBrad Bruce12-May-08 3:58 
AnswerRe: PLEASE add a demo - demo exists in sources package Pin
cromul12-May-08 10:25
membercromul12-May-08 10:25 
GeneralRe: PLEASE add a demo - demo exists in sources package Pin
Brad Bruce12-May-08 14:46
memberBrad Bruce12-May-08 14:46 
AnswerRe: Pin
cromul13-May-08 7:30
membercromul13-May-08 7:30 
GeneralRe: Pin
Brad Bruce13-May-08 12:28
memberBrad Bruce13-May-08 12:28 
AnswerRe: Pin
cromul13-May-08 20:13
membercromul13-May-08 20:13 
GeneralRe: Pin
Brad Bruce14-May-08 11:59
memberBrad Bruce14-May-08 11: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.

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