$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Dock Control for C# WinForms
Create Dock at Run Time by using Dock Control in WinForms C# applications
Home > WinForms UI Controls > User Manual > Create a Dock Window in C#

Run Time Support by Dock Control in C# Windows Forms

The WinForm Dock Control determines all the behavior managed by ToolWindows and DocumentWindows, including enable the basic capabilities of docking, floating and hiding, handle tabbed document behavior, serialization of layout and providing access to collections of managed dockable objects.

How to Create Dock at Runtime

The following is a sample that shows how to create a Dock in C# code, construct a Dock, set properties and add the Dock to a form and docks a single ToolWindow to it at runtime.

Dock dock1 = new Dock();
dock1.Dock = DockStyle.Fill;
this.Controls.Add(dock1);
ToolWindow toolWindow1 = new ToolWindow();
toolWindow1.Text = "Tool Window";
dock1.DockWindow(toolWindow1, DockPosition.Left);
Developers need to specify a target ToolWindow to configure the DockPosition of the ToolWindow to Fill. If there is no target ToolWindow when developers setting the DockPosition of a ToolWindow to Fill, the ToolWindow cannot be filled with the Dock entirely. It behaviors as it does in Microsoft Visual Studio. Developers need to dock a ToolWindow to a side and set the property of MainDocumentContainerVisible as false if they want to occupy the Dock completely with a ToolWindow.

How to Access Dock Windows

The properties of Dock Control for Windows Forms return an array of all DockWindow with a WinForms Dock instance and give developers 2 helpful properties and one method, they are list below
  • ToolWindows , the property is used for returning an array of ToolWindows.
  • DocumentWindows , this property is able to return an array of DocumentWindows.
  • GetWindows (DockState state) , this is a method used for returning an array of DockWindows that are put in a specific DockState. Developers can use the C# code snippet to return an array of DockWindows which may be hidden,

DockWindow[] hiddenWindows = dock1.DockWindows.GetWindows(DockState.Hidden);
It is also possible to get a desired ToolWindow or DocumentWindow by specifying its Name as an index:

DockWindow window1 = this.dock1.DockWindows["Form1"];
// the easier alternative
DockWindow window2 = this.dock1["Form1"];
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls