Click here to Skip to main content
6,595,854 members and growing! (17,994 online)
Email Password   helpLost your password?
Desktop Development » Miscellaneous » Miscellaneous Controls     Intermediate License: The Code Project Open License (CPOL)

Magic Library Docking Manager Designer

By Chris Richner

Provides docking support without writing one line of code.
C#, VB.NET 1.0, .NET 1.1, Win2K, WinXPVS.NET2003, Dev
Posted:22 May 2003
Updated:2 Nov 2003
Views:176,956
Bookmarked:125 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
43 votes for this article.
Popularity: 5.86 Rating: 3.59 out of 5
14 votes, 32.6%
1
3 votes, 7.0%
2

3
2 votes, 4.7%
4
24 votes, 55.8%
5

Sample Image - DockingManagerExtender.gif

Introduction

Some days ago as I coded the HelloWorld in C#, there was darkness around me. After crawling through all the articles from CodeProject, there was light. A few days later I got my first version of magic library, from this time my HelloWorld applications looks cool.

Now, much time later, spent millions of hours coding C# in my spare time and on my job, I still use the magic library. With the knowledge gained from using commercial products like Syncfusion Essentiel Tools I felt it's time to write a component for Visual Studio which provides easy access to the great docking features of Magic Library.

Key features

  • You control the docking behavior of your controls in the properties (PropertyGrid).
  • Automatic State Persistence takes care of user customization. The customized layouts are stored in the Isolated Storage.
  • Accessible wrapped DockingManager, all features of future releases of DockingManager are reachable.
  • Needed code is generated by the �Visual Studio Designer.
  • .NET friendly design with IExtenderProvider.

Background

The component implements the IExtenderProvider interface and wraps a Crownwood.Magic.Docking.DockingManager. The IExtenderProvider extends the controls on your Form with a few of the Crownwood.Magic.Docking.Content properties. At run time the component manages the Content settings for each control and attaches the controls to the wrapped DockingManager.

Using the code

Before you begin, make sure your project has a valid reference to the Magic Library. Go to the Toolbox window, right-click and select Customize Toolbox from the context menu. In the Customize Toolbox dialog, go to the .NET Framework Components tab and select the DockingManagerExtender.dll assembly that you just compiled. Now drop the DockingManagerExtender component to your form.

The component provides the following:

Public Instance Properties

AutomaticStatePersistence Enable or disable the Automatic State Persistence feature. If enabled, the customized docking settings made by the user are persistent by User/Domain/WorkingArea
ContainerControl Gets or sets the object to which the docking manager instance is attached
DockingManager The wrapped Crownwood.Magic.Docking.DockingManager. Direct access to all properties.
InnerControl Sets or gets the Control for which the docking windows will not be allowed to dock inside of the specified control.
OuterControl Sets or gets the Control for which docking windows will not be allowed to dock outside of the specified control.
PlainTabBorder Gets or sets the flag indicating that the appearance is defined as VisualStyle.Plain and this PlainTabBorder property is defined then a full dumped border is drawn around the docking window content.
VisualStyle Gets or sets the VisualStyle which is used to draw content.

Public Instance Methods

LoadConfigFromStream Restores the docking configuration.
ResetAutoPersistent Reset Automatic State Persistence. Changes takes effect after restarting application.
SaveConfigToStream Stores the docking configuration.

Please make sure that the ContainerControl property points to your form, otherwise the component cannot work properly.

Select one of your controls on this form, hit F4 and scroll down to the end in the PropertyGrid. Now you should see new properties like these ones.

After you set ADockingEnable to true, you could change the other properties. This is important, cause if the control is not dock enabled, the other properties are not valid.

If you like to know more about these properties, please refer directly to Magic Docking - VS.NET Style.

ADockingEnable Enables and disables the docking for the control.
CloseButton Enables and disables the close button of the docking window.
DockingStyle Dock style for the control.
FullTitle Text displayed in docking control title.
Icon Icon displayed in tabbed/hide mode.
TabbedMode Indicates if tabbed docking is preferred.
Title Text displayed in tabbed/hide mode.

After enabling docking for your controls, hit F5 to start debugging. If everything went right the controls are docked, finish.

In depth

There are three classes which where used to build this component. For detailed view, please refer to the NDOC generated Help File.

Classes

Class Description
DockingContent Wraps Crownwood.Magic.Docking.Content and extends it with needed properties.
DockingManagerConverter DockingManagerConverter provides a TypeConverter for the Crownwood.Magic.Docking.DockingManager
DockingManagerExtender DockingManagerExtender enhances Crownwood.Magic.Docking.DockingManager for design time. It extends the controls on your form with properties, which defines the docking behavior at run time.

Conclusion

  • The order of the controls in the InitializeComponent() method is important for docking order. If you like to dock two controls (A,B) in tabbed mode on the left side, and another (C) not tabbed on the left upper side, please make sure control (C) comes before (A,B), otherwise the docking order is not correct.
  • Every time you change the docking properties with AutomaticStatePersistence, true, you do not see the changes made directly. The DockingManager overrides the changes made with the stored settings. To solve this problem you should not use AutomaticStatePersistence for development.

Future version and features

The next version should provide real designer support, where you can drag your docking control in the designer. The default layout, specified in the designer, should be stored to a resource file, which is embedded in the assembly.

With such a designer, it's more intuitive to design docking arrangements, but my knowledge about design time components is not at a high level ,(

Links

History

  • 29.10.2003 - Version 1.1 released which supports UserControl's as ContainerControl
  • 27.05.2003 - bug fixed, generated IsolatedStorage path longer than 260 chars in some cases, updated downloads.
  • 24.05.2003 - experimental release

Have fun with it...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Chris Richner


Member
Web


Biography

  • 1996 - 1998 PC Board PPL, HTML, DHTML, Javascript and ASP

  • 1999 - 2001 coding Centura against Sql Database (Centura,MSSQL,Oracle)

  • 2002 - 2004 C# Windows Forms

  • 2005 - 2006 C# ASP.NET, Windows Forms

  • 2006 - now C#, WCF, WF, WinForms


Interests

  • basically coding

  • Keep my network and computers alive

  • Go out with my friends and listen to the tight house
    beats in da clubs.

Occupation: Systems Engineer
Location: Switzerland Switzerland

Other popular Miscellaneous articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 130 (Total in Forum: 130) (Refresh)FirstPrevNext
GeneralHow to change the dockstate in a content ? PinmemberChen.shaohua21:50 23 Aug '09  
GeneralRe: How to change the dockstate in a content ? PinmemberChris Richner23:45 24 Aug '09  
GeneralRe: How to change the dockstate in a content ? PinmemberChen.shaohua5:36 25 Aug '09  
GeneralCompatible Version with VS2005 PinmemberChallagolla0:37 22 Jul '09  
GeneralRe: Compatible Version with VS2005 PinmemberChris Richner5:33 22 Jul '09  
GeneralRe: Compatible Version with VS2005 PinmemberChallagolla21:05 22 Jul '09  
GeneralRe: Compatible Version with VS2005 PinmemberChris Richner11:41 3 Aug '09  
GeneralHow Free is free? PinmemberFindl_Fantastisch20:59 26 Jun '07  
Generalcapture Dock window Hiding and Showing events PinmemberAmbili_T0:15 18 Apr '07  
GeneralShowing the panels as docked when app starts up. ! PinmemberAmbili_T2:56 12 Apr '07  
AnswerRe: Showing the panels as docked when app starts up. ! PinmemberChris Richner9:31 13 Apr '07  
GeneralRe: Showing the panels as docked when app starts up. ! PinmemberAmbili_T19:41 16 Apr '07  
AnswerRe: Showing the panels as docked when app starts up. ! PinmemberChris Richner8:40 17 Apr '07  
GeneralRe: Showing the panels as docked when app starts up. ! PinmemberAmbili_T21:07 17 Apr '07  
GeneralChange location of docked window PinmemberShakeel Mumtaz1:04 1 Oct '06  
Generalgetting event handler for hide button clicked Pinmemberbhavesh vaghela2:08 7 Feb '06  
QuestionOwn Visualstyles Pinmembervornst14:33 28 Jan '06  
GeneralHelp needed: unable to generate DLL Pinmemberrun149213:49 1 Nov '05  
GeneralRe: Help needed: unable to generate DLL Pinmemberdeloford13:48 5 Jul '06  
GeneralI was just thinkign of this! PinmemberKevin James8:21 26 Oct '05  
GeneralFree Magic library is still available Pinsussmotif821:12 12 Oct '05  
AnswerBAd link -- Re: Free Magic library is still available PinmemberKevin James8:22 26 Oct '05  
GeneralRe: Free Magic library is still available Pinmemberbadfire0:56 5 Dec '05  
GeneralAutohide PinmemberPiovra_22:28 26 Jul '05  
GeneralNow it is no more for free PinsussAnonymous6:57 7 Jun '05  

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

PermaLink | Privacy | Terms of Use
Last Updated: 2 Nov 2003
Editor: Smitha Vijayan
Copyright 2003 by Chris Richner
Everything else Copyright © CodeProject, 1999-2009
Web17 | Advertise on the Code Project