Click here to Skip to main content
13,149,073 members (58,986 online)
Click here to Skip to main content
Add your own
alternative version


500 bookmarked
Posted 3 Jun 2006

A Visual Studio 2005-like Interface

, 22 Jan 2007
Rate this:
Please Sign up or sign in to vote.
Apply a theme that resembles Visual Studio 2005 to the DockPanel Suite, using an Extender class.
Sample Image - DockPanelSkin.png


It's now been awhile since programs like Opera, Firefox and other software introduced MDI tabbed interfaces. Unluckily, there are not too many free components that allow .NET developers to create such interfaces. I was searching the internet for a long time before discovering the DockPanel Suite, a wonderful and fully customizable component from Weifen Luo. This component is available on Sourceforge, here.


This article shows how the DockPanel component can be customized, implementing an Extender class. The attached example creates a Visual Studio 2005 like interface against version 1.0 of the DockPanel.


Weifen Luo is the owner of the copyright for the DockPanel Suite, which includes the Extender class, the object of this article.


This article is based around the DockPanel Suite library and it requires at least a basic knowledge of this. Please refer to the References paragraph to find more information about it. A good knowledge of the System.Drawing classes and functions is also required.

The Extender Class

DockPanel accepts customizations through five classes:

  • AutoHideTab represents a single tab used when the content is in the autohide state.
  • AutoHideStrip draws tabstrips and tabs when the content is in the autohide state.
  • DockPaneCaption draws the caption pane when the contents are tool windows.
  • DockPaneTab represent a single tab used when the content is a document window or a tool window.
  • DockPaneStrip draws tabstrips and tabs when the content is a document window or a tool window.

For convenience, these classes are enclosed in an Extender class. The following sections describe the component parts and the relative modules you can customize.

AutoHideStrip and AutoHideTab

The autohide strips can appear at the four borders of the main form and they are activated by the MouseOver event. The tabstrip will be visible only if at least one content is in the autohide state. When the tabs are docked to the left or to the right, the resulting tabs are rotated 90 degrees.

Following is a screenshot of a form docked to the top:

Here is another example of a form docked to the bottom:

The drawing of tabstrips and tabs is done by the class AutoHideStripFromBase. The painting methods are mainly the following:

  • OnPaint handles the OnPaint event of the control.
  • DrawTabStrip draws the tabstrips with a right orientation and all the contained tabs.
  • DrawTab draws a single tab.


DockPaneCaption represents the form border when the form is docked and it normally contains a title, a button to close the window and a button to set the window to the autohide state. The Visual Studio 2005 like interface also contains a button to manipulate the window state through a context menu.

The following is a screenshot of DockPaneCaption:

The drawing of the caption is done by the class DockPaneCaptionFromBase. The painting methods are mainly the following:

  • OnPaint handles the OnPaint event of the control.
  • DrawCaption draws the background and the caption text.

DockPaneStrip and DockPaneTab

DockPaneStrip represents the tab area shown when the content is a tool window or a document. There are many differences between these two regarding the tab shape and other behaviour. An example is hiding the tabstrip in the case of a single content. The drawing of tabstrips and tabs is done by the class DockPaneStripFromBase. The following examples will clarify these differences.

Example of a tabstrip that shows document tabs:

Example of a tabstrip that shows document tabs with an icon and the overflow symbol:

Example of a tabstrip that shows tool window tabs:

The painting methods for the document tabstrip are the following:

  • OnPaint handles the OnPaint event of the control.
  • DrawTabStrip_Document draws the background.
  • DrawTab_Document draws the shape, icon and text.

The painting methods for the tool window tabstrip are the following:

  • OnPaint handles the OnPaint event of the control.
  • DrawTabStrip_ToolWindow draws the background.
  • DrawTab_ToolWindow draws the shape, icon, and text.

Using the Code

To apply the Extender to an instance of DockPanel, insert the following code into the Form_Load event of your form, replacing the name of the control with yours.

Extender.SetSchema(DockPanel1, Extender.Schema.FromBase)

Final Notes

I hope that you find this article useful. If you find this article stupid, annoying or incorrect, express this fact by rating the article as you see fit. In the end, you're very welcome at any moment to freely contribute to this project by suggesting improvements or by submitting code or other materials.


Thanks to Weifen Luo for providing the community with the DockPanel component. If you like this component, you may want to make a donation to Weifen Luo here.



  • 3rd June 2006: first submission
  • 20th July 2006: bug fix (the MdiParent property doesn't need to be set)
  • 20nd January 2007: updated download


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


About the Author

Danilo Corallo
Software Developer (Senior)
Italy Italy
I am 35 years old and I've been working with C++, Visual Basic .NET, C# and ASP.NET. I have a large experience in Industrial Automation solutions, but I've worked also as Web developer and DBA. I like to share knowledge and projects with other people.

You may also be interested in...

Comments and Discussions

QuestionShape of tab headers Pin
Bogdan Vintila10-Nov-15 5:10
memberBogdan Vintila10-Nov-15 5:10 
Questionthank you Pin
Member 119705078-Sep-15 22:57
memberMember 119705078-Sep-15 22:57 
QuestionHow to add forms and controls to them Pin
Snehasish Nandy21-Dec-12 0:31
memberSnehasish Nandy21-Dec-12 0:31 
Questioni need a tutorial Pin
vahnvallain30-Aug-11 20:17
membervahnvallain30-Aug-11 20:17 
GeneralMy vote of 5 Pin
E$w@r24-Feb-11 17:51
memberE$w@r24-Feb-11 17:51 
GeneralMy vote of 5 Pin
alifellod4-Nov-10 10:04
memberalifellod4-Nov-10 10:04 
Generalconvert this code to C# Pin
sa.alavifar23-Oct-10 22:07
membersa.alavifar23-Oct-10 22:07 
GeneralMy vote of 5 Pin
sa.alavifar23-Oct-10 21:59
membersa.alavifar23-Oct-10 21:59 
GeneralUnable to set max size of form without grey strip running along the bottom Pin
LindseyTantrum3-Sep-10 3:09
memberLindseyTantrum3-Sep-10 3:09 
GeneralRe: Unable to set max size of form without grey strip running along the bottom Pin
LindseyTantrum23-Sep-10 0:38
memberLindseyTantrum23-Sep-10 0:38 
QuestionPaint TitleBar Pin
Eugene Kogel23-Apr-10 16:12
memberEugene Kogel23-Apr-10 16:12 
GeneralWorking with WeifenLuo.WinFormsUI.Docking.dll version Pin
nisad13-Oct-09 4:24
membernisad13-Oct-09 4:24 
Questionwill this work with Visual Basic 2008 Express Edition? Pin
Member 363971330-Sep-09 14:39
memberMember 363971330-Sep-09 14:39 
QuestionEvent Problem? No LostFocus and Leave Events on floating Windows? Pin
Skeletor2314-Sep-09 4:51
memberSkeletor2314-Sep-09 4:51 
GeneralFor hide tab when have a single Document Pin
Pasalino9-Sep-09 3:40
memberPasalino9-Sep-09 3:40 
QuestionHow can i change automatically all locale files used in each one of the forms ? Pin
agelospanagiotakis31-Aug-09 0:33
memberagelospanagiotakis31-Aug-09 0:33 
QuestionHow Can I Impement Dock content to Left by Extendering the DocumentTabStripLocation Enumerable with Adding Left property? Pin
hjzhou29-Aug-09 21:12
memberhjzhou29-Aug-09 21:12 
Generalgreat work. =) Pin
francis314-Aug-09 22:40
memberfrancis314-Aug-09 22:40 
GeneralCommunication between docks Pin
hakimgada5-Jul-09 21:20
memberhakimgada5-Jul-09 21:20 
GeneralDoubts.. wud be sweet if someone cud help me , please Pin
Gagan111813-Jun-09 15:43
memberGagan111813-Jun-09 15:43 
Generalimplement VOIP Pin
mzamoandris1-Jun-09 4:05
membermzamoandris1-Jun-09 4:05 
Questionhow to doc different forms Pin
ghalibkhan14-May-09 22:05
memberghalibkhan14-May-09 22:05 
General[Message Deleted] Pin
NoKindOfName21-Mar-09 18:56
memberNoKindOfName21-Mar-09 18:56 
GeneralRe: How to add things Pin
sndwchmkr2-May-09 13:08
membersndwchmkr2-May-09 13:08 
GeneralRe: How to add things Pin
sndwchmkr2-May-09 13:09
membersndwchmkr2-May-09 13:09 
QuestionThank you! Pin
Morgan19819-Feb-09 4:08
memberMorgan19819-Feb-09 4:08 
AnswerRe: Thank you! Pin
PCBuilder15-Mar-09 5:37
memberPCBuilder15-Mar-09 5:37 
GeneralMore than 10 tabstrips that shows in tool window tabs which becomes hard to see Pin
eet7631-Dec-08 1:42
membereet7631-Dec-08 1:42 
GeneralDocking fails on a NON-maximized window Pin
stmarcus6-Oct-08 16:04
memberstmarcus6-Oct-08 16:04 
QuestionRe: Docking fails on a NON-maximized window Pin
Jeff Bowman7-Nov-08 15:32
memberJeff Bowman7-Nov-08 15:32 
Generalerror on closing application Pin
migserra5-Sep-08 7:06
membermigserra5-Sep-08 7:06 
Generalstay first default document open Pin
Member 11476654-Sep-08 8:16
memberMember 11476654-Sep-08 8:16 
GeneralWeifenLuo.WinFormsUI.Docking.dll with 2008 Pin
user000000000110-Aug-08 20:28
memberuser000000000110-Aug-08 20:28 
GeneralRe: WeifenLuo.WinFormsUI.Docking.dll with 2008 Pin
ofwood24-Nov-08 12:25
memberofwood24-Nov-08 12:25 
Generalc# Pin
cakirhal28-Jul-08 20:27
membercakirhal28-Jul-08 20:27 
Questionhow can i put a dock content on top of another during formload Pin
jeipiyaku24-Jul-08 23:06
memberjeipiyaku24-Jul-08 23:06 
GeneralUpdating Status Bar Pin
Alexander Higgins21-Jul-08 17:54
memberAlexander Higgins21-Jul-08 17:54 
GeneralAuto Arranging documents Pin
rolf.evenblij@alice.nl14-Jul-08 23:41
memberrolf.evenblij@alice.nl14-Jul-08 23:41 
GeneralHi Pin
T. Ravindran11-Jun-08 19:05
memberT. Ravindran11-Jun-08 19:05 
GeneralHi.... DockPaneStrip - how to hide the tabstrip in the case of a single content Pin
Mirjan19-May-08 3:14
memberMirjan19-May-08 3:14 
Generalsuport for RTL. Pin
CSharpDevelopers13-May-08 9:14
memberCSharpDevelopers13-May-08 9:14 
Generalthanks a lot! Pin
fast200812-May-08 21:53
memberfast200812-May-08 21:53 
GeneralMapPoint and docking Pin
mmjc2329-Feb-08 3:26
membermmjc2329-Feb-08 3:26 
GeneralAvoid Close for the DockPanel [modified] Pin
seasea31-Jan-08 20:38
memberseasea31-Jan-08 20:38 
GeneralCommunication between panels Pin
Brandon Nason13-Dec-07 3:31
memberBrandon Nason13-Dec-07 3:31 
GeneralRe: Communication between panels Pin
lextm2-Feb-08 2:08
memberlextm2-Feb-08 2:08 
GeneralRe: Communication between panels Pin
Danilo Corallo15-Apr-08 22:44
memberDanilo Corallo15-Apr-08 22:44 
GeneralVS2005 like tabbed interface Pin
irfan.hafid15-Nov-07 12:55
memberirfan.hafid15-Nov-07 12:55 
GeneralChange the Back colur Pin
danasegaranea31-Oct-07 19:34
memberdanasegaranea31-Oct-07 19:34 
Newstoolstripcontainer + dockpanel solution Pin
XDG6-Oct-07 2:43
memberXDG6-Oct-07 2:43 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170924.2 | Last Updated 22 Jan 2007
Article Copyright 2006 by Danilo Corallo
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid