Click here to Skip to main content
6,594,432 members and growing! (14,242 online)
Email Password   helpLost your password?
Desktop Development » Toolbars & Docking windows » Docking Windows     Intermediate License: A Public Domain dedication

Visual Studio IDE like Dock Container

By Cristinel Mazarine

Free Windows dock container
C#, Windows
Version:4 (See All)
Posted:11 May 2008
Updated:14 May 2009
Views:56,863
Bookmarked:167 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
28 votes for this article.
Popularity: 5.35 Rating: 3.70 out of 5
3 votes, 10.7%
1
2 votes, 7.1%
2
4 votes, 14.3%
3
6 votes, 21.4%
4
13 votes, 46.4%
5

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

About the Author

Cristinel Mazarine


Member

Occupation: CEO
Company: SC Crom-Osec SRL
Location: Romania Romania

Other popular Toolbars & Docking windows articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 68 (Total in Forum: 68) (Refresh)FirstPrevNext
GeneralVS2008 complains when I load the example project PinmemberIvanBohannon4:55 26 Oct '09  
GeneralMy vote of 1 Pinmembersmton13:51 13 Jul '09  
GeneralRe: My vote of 1 Pinmemberjaimi5:17 21 Jul '09  
GeneralBug - Text selection with mouse does not work PinmemberFredo1:59 5 Jun '09  
GeneralSome questions PinmemberLomionAcc7:03 20 May '09  
GeneralRe: Some questions PinmemberAjunta1:43 17 Aug '09  
GeneralSome important issues with docking Pinmemberdpk_kbsht22:04 13 May '09  
AnswerRe: Some important issues with docking Pinmembercromul9:26 14 May '09  
GeneralCompared with WeifenLuo's DockPanel Suite PinmemberPinx4:47 12 May '09  
GeneralThe DockContainer class is the user control which host the tool windows. PinmemberIraticus7:38 9 May '09  
NewsRe: The DockContainer class is the user control which host the tool windows. Pinmembercromul8:32 10 May '09  
GeneralEvents not triggering when you derive from DockableToolWindow PinmemberJayKnobler20:00 22 Apr '09  
AnswerRe: Events not triggering when you derive from DockableToolWindow Pinmembercromul3:18 24 Apr '09  
QuestionI need a Help in your control Pinmembertusharcapoor22:16 4 Feb '09  
GeneralDock My Form Pinmembercanci8:45 18 Dec '08  
AnswerRe: Dock My Form Pinmembercromul6:20 19 Dec '08  
AnswerRe: Dock My Form PinmemberAntonioElVampiro13:36 13 Jan '09  
GeneralRe: Dock My Form [modified] Pinmemberjoeller7:28 9 Apr '09  
GeneralRe: Dock My Form Pinmemberjoeller11:26 9 Apr '09  
GeneralVista Bug not showing hide buttons Pinmembergrahamdodd15:18 27 Nov '08  
GeneralRe: Vista Bug not showing hide buttons Pinmembercromul2:26 1 Dec '08  
GeneralRe: Vista Bug not showing hide buttons Pinmembernymrin13:12 28 Jan '09  
GeneralRe: Vista Bug not showing hide buttons Pinmembernymrin13:40 28 Jan '09  
QuestionActive Window Pinmemberambarishtv19:46 28 Aug '08  
AnswerRe: Active Window Pinmembercromul11:27 4 Nov '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 14 May 2009
Editor: Deeksha Shenoy
Copyright 2008 by Cristinel Mazarine
Everything else Copyright © CodeProject, 1999-2009
Web20 | Advertise on the Code Project