Advanced Layout of Dock Control for C# WinForms
The following is a tutorial that demonstrates how to create an advanced layout of ToolWindows and DocumentWindows in Windows Forms in C# code and how to display the built layout. In this tutorial, a floating window with 120 height and 260 width will hold two ToolWindows. The SizeInfo property of the TabStrip containers will be used. With the property, developers can configure the TabStrip in a precise size and set a relative size for TabStrip to keep 2 TabStrip in a specific size.
How to Build the Layout in C#
Drag and drop a Dock Control instance to a form. Change the property of Dock to Fill and subscribe to the Form_Load in which the windows layout will be implemented.
Create ToolWindows. The first ToolWindow will be docked left and the rest of ToolWindows will be docked left-bottom. The first one will be set to the target in the DockWindow method that will dock the second ToolWindow
Set the height of the TabStrip of the second window relative to the height of the first one:
Now we need add another two windows and set the Width of TabStrip of the fourth window as an absolute value, 120 pixels, which will not change even if the width of the third one changed
Add another two ToolWindows and float the ToolWindows. Here, developers can customize the size and location of the form that will host the ToolWindows
Add one more ToolWindow and automatically hide the ToolWindow to Top by setting the AutoHideLocation property of the TabStrip that hosts the ToolWindow.
Display the DocumentWindows by setting the property as Yes with the C# code below. DocumentWindow document1 = new DocumentWindow(); document1.Name = "document1"; this.dock1.AddDocument(document1); DocumentWindow document2 = new DocumentWindow(); document2.Name = "document2"; this.dock1.AddDocument(document2, document1, DockLocation.Bottom); | ![]() UI Controlsfor Windows Forms .NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI DesignWinForms UI Controls WinForms Buttons UI Control WinForms Calendar UI ControlWinForms Carousel UI ControlWinForms Chart UI ControlWinForms Clock UI ControlCommandBar UI ControlWinForms Dock UI ControlDock - Getting Started Architecture and Features Arrange WindowsFloating WindowsAuto-Hide WindowsContext MenuReDockObject Model Create a Dock WindowCreate WindowRemove WindowAdvanced LayoutTab & CaptionAllowed Dock StatesUser Control and FormsLoad and Save LayoutDock - LocalizationDesktop Alert UI ControlDropDown List UI ControlWinForms Editor UI ControlForms and Dialogs UI ControlWinForms GridView UI ControlWinForms ListView UI ControlWinForms Menu UI ControlWinForms ComboBox UI ControlWinForms PageView UI ControlPanels and Labels UI ControlWinForms Panorama UI ControlWinForms PDFViewer UI ControlWinForms Property Grid UI ControlWinForms Ribbon UI ControlWinForms PivotGrid UI ControlWinForms RichTextBox UI ControlWinForms Rotator UI ControlWinForms Scheduler UI ControlWinForms Shortcuts UI ControlWinForms SpellChecker UI ControlWinForms Track & Status UI ControlWinForms TreeView UI ControlWinForms Wizard UI ControlWinForms Test UI ControlWinForms Theme UI Control |