Click here to Skip to main content
Click here to Skip to main content

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 contact@osec.ro .

Thank you all for using this product.

Introduction

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:

Crom

Background

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)
   {
      _dockContainer.UndockToolWindow(toolWindow);
      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 contact@osec.ro for additional information.

History

  • First version of this product was released on 2008.05.07

License

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

Share

About the Author

No Biography provided

Comments and Discussions

 
QuestionAny way to not resize the main/filled dock when docking a side panel PinmemberJudyCW26-Jun-13 18:56 
QuestionIDE Like Tabbed Document. PinmemberRitesh Khatri4-Nov-12 0:17 
QuestionLove it Pinmemberstevecocks12-Sep-12 23:37 
QuestionImprove tags PinmvpSergey Alexandrovich Kryukov22-Jun-12 15:58 
QuestionCrom.controls problem when moving windows Pinmemberolivier BALFOURIER14-Jun-12 21:02 
QuestionCan not download the source files.. Pinmemberleilifan11-Apr-12 16:04 
Questionmodification to childforms. Pinmemberpasupulety31-Jan-12 20:18 
QuestionChanges to DockToolWindows . Pinmemberpasupulety31-Jan-12 20:12 
GeneralMy vote of 5 PinmemberVB_ Coder13-Jul-11 10:45 
GeneralDock container with Textbox issues PinmemberChalcy12-May-11 1:17 
AnswerRightToLeft Not Work. PinmemberBiyuk Sadeghi Lahijan28-Feb-11 4:27 
QuestionAdding Dockables at Design Editor? PinmemberBarzille31-Dec-09 0:23 
GeneralVS2008 complains when I load the example project PinmemberIvanBohannon26-Oct-09 3:55 
GeneralMy vote of 1 Pinmembersmton13-Jul-09 12:51 
GeneralRe: My vote of 1 Pinmemberjaimi21-Jul-09 4:17 
GeneralRe: My vote of 1 PinmemberJohnny J.31-May-10 2:27 
GeneralRe: My vote of 1 PinmemberRugbyLeague10-May-12 4:16 
GeneralBug - Text selection with mouse does not work PinmemberFredo5-Jun-09 0:59 
GeneralSome questions PinmemberLomionAcc20-May-09 6: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: 1.0.0.6
.NET 3.5
 
Thank You
GeneralRe: Some questions PinmemberAjunta17-Aug-09 0:43 
GeneralSome important issues with docking Pinmemberdpk_kbsht13-May-09 21:04 
AnswerRe: Some important issues with docking Pinmembercromul14-May-09 8:26 
GeneralCompared with WeifenLuo's DockPanel Suite PinmemberPinx12-May-09 3:47 
GeneralRe: Compared with WeifenLuo's DockPanel Suite Pinmembervincezed9-Apr-11 3:21 
GeneralRe: Compared with WeifenLuo's DockPanel Suite PinmemberPinx11-Apr-11 2:30 
GeneralThe DockContainer class is the user control which host the tool windows. PinmemberIraticus9-May-09 6:38 
NewsRe: The DockContainer class is the user control which host the tool windows. Pinmembercromul10-May-09 7:32 
GeneralEvents not triggering when you derive from DockableToolWindow PinmemberJayKnobler22-Apr-09 19:00 
AnswerRe: Events not triggering when you derive from DockableToolWindow Pinmembercromul24-Apr-09 2:18 
QuestionI need a Help in your control Pinmembertusharcapoor4-Feb-09 21:16 
GeneralDock My Form Pinmembercanci18-Dec-08 7:45 
AnswerRe: Dock My Form Pinmembercromul19-Dec-08 5:20 
AnswerRe: Dock My Form PinmemberAntonioElVampiro13-Jan-09 12:36 
GeneralRe: Dock My Form [modified] Pinmemberjoeller9-Apr-09 6:28 
GeneralRe: Dock My Form Pinmemberjoeller9-Apr-09 10:26 
GeneralVista Bug not showing hide buttons Pinmembergrahamdodd27-Nov-08 14:18 
GeneralRe: Vista Bug not showing hide buttons Pinmembercromul1-Dec-08 1:26 
GeneralRe: Vista Bug not showing hide buttons Pinmembernymrin28-Jan-09 12:12 
GeneralRe: Vista Bug not showing hide buttons Pinmembernymrin28-Jan-09 12:40 
QuestionActive Window Pinmemberambarishtv28-Aug-08 18:46 
AnswerRe: Active Window Pinmembercromul4-Nov-08 10:27 
GeneralRedocking forms Pinmemberaiman6925-Aug-08 23:10 
GeneralRe: Redocking forms Pinmembergjconely23-Oct-08 6:38 
GeneralRe: Redocking forms Pinmembercromul4-Nov-08 10:26 
GeneralRe: Redocking forms Pinmembercromul4-Nov-08 10:28 
QuestionLinks not working Pinmembermorphias0@yahoo.com18-Aug-08 4:53 
GeneralRe: Links not working Pinmembercromul4-Nov-08 10:29 
GeneralOther MDI forms PinmemberGreg Conely7-Jul-08 6:17 
AnswerRe: Other MDI forms Pinmembercromul7-Jul-08 8:41 
GeneralRe: Other MDI forms Pinmemberaiman6925-Aug-08 22:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.8.141015.1 | Last Updated 14 May 2009
Article Copyright 2008 by Cristinel Mazarine
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid