Click here to Skip to main content
15,860,943 members
Articles / Programming Languages / Visual Basic

Magic Library Docking Manager Designer

Rate me:
Please Sign up or sign in to vote.
3.39/5 (49 votes)
16 May 2013CPOL4 min read 433.6K   21.7K   160   135
Provides docking support without writing one line of code.

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 Image 2DockingManagerExtender component to your form.

The component provides the following:

Public Instance Properties

Image 3 AutomaticStatePersistenceEnable or disable the Automatic State Persistence feature. If enabled, the customized docking settings made by the user are persistent by User/Domain/WorkingArea
Image 4 ContainerControlGets or sets the object to which the docking manager instance is attached
Image 5 DockingManagerThe wrapped Crownwood.Magic.Docking.DockingManager. Direct access to all properties.
Image 6 InnerControlSets or gets the Control for which the docking windows will not be allowed to dock inside of the specified control.
Image 7 OuterControlSets or gets the Control for which docking windows will not be allowed to dock outside of the specified control.
Image 8 PlainTabBorderGets 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.
Image 9 VisualStyleGets or sets the VisualStyle which is used to draw content.

Public Instance Methods

Image 10 LoadConfigFromStreamRestores the docking configuration.
Image 11 ResetAutoPersistentReset Automatic State Persistence. Changes takes effect after restarting application.
Image 12 SaveConfigToStreamStores 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.

Image 13

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.

Image 14 ADockingEnableEnables and disables the docking for the control.
Image 15 CloseButtonEnables and disables the close button of the docking window.
Image 16 DockingStyleDock style for the control.
Image 17 FullTitleText displayed in docking control title.
Image 18 IconIcon displayed in tabbed/hide mode.
Image 19 TabbedModeIndicates if tabbed docking is preferred.
Image 20 TitleText 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

ClassDescription
DockingContentWraps Crownwood.Magic.Docking.Content and extends it with needed properties.
DockingManagerConverterDockingManagerConverter provides a TypeConverter for the Crownwood.Magic.Docking.DockingManager
DockingManagerExtenderDockingManagerExtender 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.

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

enjoy! 

License

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


Written By
Software Developer (Senior)
Switzerland Switzerland
My interest is in the future because I am going to spend the rest of my life there. (Charles Kettering)

Biography

  • 1996 - 1998 PC Board PPL, HTML, DHTML, Javascript and ASP
  • 1999 - 2001 coding Centura against Sql Database (SqlBase,MSSQL,Oracle)
  • 2002 - 2004 C# Windows Forms
  • 2005 - 2006 C# ASP.NET, Windows Forms
  • 2006 - 2009 C#, WCF, WF, WPF
  • 2010 - 2012 C#, Dynamics CRM, Sharepoint, Silverlight
  • 2013 - 2013 C#, WCF DS (OData), WF, WPF
  • 2014 - 2016 C#, Azure PaaS, Identity, OWIN, OData, Web Api
  • 2017 - now C#, aspnet.core, IdentityServer4, TypeScript & Angular @ Azure IaaS or PaaS

Interests

  • family & friends
  • chilaxing ,)
  • coding

Comments and Discussions

 
GeneralRe: The next version should provide real designer support Pin
Chris Richner8-Jun-03 7:30
Chris Richner8-Jun-03 7:30 
Generalcoooooooooooooooooooooooooool Pin
iano12323-May-03 23:46
iano12323-May-03 23:46 
GeneralRe: coooooooooooooooooooooooooool Pin
Chris Richner24-May-03 3:01
Chris Richner24-May-03 3:01 
QuestionWhy? Pin
Paul Selormey23-May-03 19:43
Paul Selormey23-May-03 19:43 
AnswerRe: Why? Pin
Chris Richner24-May-03 3:00
Chris Richner24-May-03 3:00 
GeneralRe: Why? Pin
Paul Selormey25-May-03 0:50
Paul Selormey25-May-03 0:50 
AnswerRe: Why? Pin
Rocky Moore25-May-03 3:24
Rocky Moore25-May-03 3:24 
GeneralRe: Why? Pin
Paul Selormey25-May-03 3:31
Paul Selormey25-May-03 3:31 
GeneralRe: Why? Pin
Chris Richner25-May-03 5:05
Chris Richner25-May-03 5:05 
GeneralRe: Why? Pin
Paul Selormey25-May-03 14:14
Paul Selormey25-May-03 14:14 

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.