WinForms dock panels

If you are doing WinForms development, one common issue is that you often have a lot of information to show, but you don’t want to clutter the screen. How Visual Studio has solved that, is by having dockable windows.

What if I told you, you could do that with your applications? What if I told you, you could do that with your applications with a stable, open-source product, for free?

Check out:

What does it do?
Here is the sample app that comes with it. Basically, you can dock any Windows Form to act as a MDI child, or any of the toolboxes that become pinnable on the margins. For example:

VS2012 skin:

VS2005 skin:

Just like with Visual Studio, you can drag-and-drop any window to be docked – anywhere. It works and acts exactly like Visual Studio in-fact! You can also pre-layout the windows and disable the user from being able to move windows too.

How do you do this?
How I’ve been using it is that you create a new Form for each piece of functionality you want. Then, in the code-behind, you change it from inherting Form – to inherit DockContent (which is in the .dll)

Then, back in the MDI container, you can then do things like this:

DummyDoc form1 = new DummyDoc(); // A Windows Form that inherits from DockContent
DummyDoc form2 = new DummyDoc();
DummyDoc form3 = new DummyDoc();
DummyDoc form4 = new DummyDoc();

// Bottom pane, default it to auto-hide.
form1.Show(this.dockPanel, DockState.DockBottomAutoHide);
// Regular, main MDI child (document)
form2.Show(this.dockPanel, DockState.Document);
// Left pane, not hidden
form3.Show(this.dockPanel, DockState.DockLeft);
// Right pane, auto-hidden by default
form4.Show(this.dockPanel, DockState.DockRightAutoHide);

.csharpcode, .csharpcode pre
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
background-color: #f4f4f4;
width: 100%;
margin: 0em;
.csharpcode .lnum { color: #606060; }

Bottom Line:
I’ve been messing around with this for the past few days and this seems rock-solid and VERY full-featured! If you are doing WinForms development and want a way to have collapsible windows, this is a great alternative.

Posted in .NET 3.5, .NET 4.0, New Technology, Uncategorized, WinForms

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2 other followers

%d bloggers like this: