5,696,576 members and growing! (19,603 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 cromul

Free windows dock container
C#, Windows

Posted: 11 May 2008
Updated: 11 May 2008
Views: 19,443
Bookmarked: 76 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
18 votes for this Article.
Popularity: 4.56 Rating: 3.63 out of 5
3 votes, 16.7%
1
2 votes, 11.1%
2
0 votes, 0.0%
3
5 votes, 27.8%
4
8 votes, 44.4%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Introduction

This article describes how to use the free dock container library in your applications.
You can download full sources from http://www.osec.ro/en/index.php/Downloads#Dock_container.
Full documentation for the product can be accessed at http://www.osec.ro/en/index.php/Documentation.

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 specialize this class. By default this property allows docking the tool window on all panels. Overriding this property can be changed the dock behavior of the tool window (for example can allow only dock left or right).

The DockContainer class is the user control which host the tool windows.

This control should be added to the main form and docked fill.
Then can add forms to it using 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);
   }

 

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

Full documentation of this product can be accessed at the site mentioned on 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

cromul



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

Other popular Toolbars & Docking windows articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 43 (Total in Forum: 43) (Refresh)FirstPrevNext
GeneralVista Bug not showing hide buttonsmembergrahamdodd15:18 27 Nov '08  
GeneralRe: Vista Bug not showing hide buttonsmembercromul2:26 1 Dec '08  
QuestionActive Windowmemberambarishtv19:46 28 Aug '08  
AnswerRe: Active Windowmembercromul11:27 4 Nov '08  
GeneralRedocking formsmemberaiman690:10 26 Aug '08  
GeneralRe: Redocking formsmembergjconely7:38 23 Oct '08  
GeneralRe: Redocking formsmembercromul11:26 4 Nov '08  
GeneralRe: Redocking formsmembercromul11:28 4 Nov '08  
QuestionLinks not workingmembermorphias0@yahoo.com5:53 18 Aug '08  
GeneralRe: Links not workingmembercromul11:29 4 Nov '08  
GeneralOther MDI formsmemberGreg Conely7:17 7 Jul '08  
AnswerRe: Other MDI formsmembercromul9:41 7 Jul '08  
GeneralRe: Other MDI formsmemberaiman6923:48 25 Aug '08  
Question"not always on top"memberAVXT7:46 4 Jul '08  
AnswerRe: "not always on top"membercromul9:43 7 Jul '08  
GeneralDocumentationmemberAngelo DeFusco18:48 30 Jun '08  
AnswerRe: Documentationmembercromul22:58 1 Jul '08  
QuestionBug 1 and about 2 kind improvement programsmemberseeper0:44 17 Jun '08  
AnswerRe: Bug 1 and about 2 kind improvement programsmembercromul23:01 1 Jul '08  
QuestionTabButton TextRenderer problemmemberel Golem9:35 7 Jun '08  
AnswerRe: TabButton TextRenderer problemmembercromul9:03 9 Jun '08  
GeneralDockStyle.Fill doesn´t workmemberMichaelgor7:11 31 May '08  
GeneralRe: DockStyle.Fill doesn´t workmembercromul8:35 2 Jun '08  
GeneralRe: DockStyle.Fill doesn´t workmemberMichaelgor9:06 2 Jun '08  
AnswerRe: DockStyle.Fill doesn´t workmembercromul11:49 2 Jun '08  

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

PermaLink | Privacy | Terms of Use
Last Updated: 11 May 2008
Editor:
Copyright 2008 by cromul
Everything else Copyright © CodeProject, 1999-2008
Web12 | Advertise on the Code Project