$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Dock Control for C# WinForms
Docking User Controls and Forms of Dock Control in C# Windows Forms C# projects
Home > WinForms UI Controls > User Manual > User Control and Forms in C#

Docking User Controls and Forms for C# WinForms

The Kettic Windows Forms Dock Control provides a useful method, the DockControl, for developers to dock the UserControls and Forms in Dock. It is capable of docking a Form, a UserControl, or simply any Control. This method will create a HostWindow with DockType ToolWindow to host the Dock Control. The following is a tutorial demonstrating how to use the DockControl method.

How to Dock a Form in C# Code


Form form = new Form();
form.BackColor = Color.Pink;
form.Text = "My Form";
this.dock1.DockControl(form, DockLocation.Left);
form.Display();

How to Dock a UserControl in C# Code

We are going to learn how to Dock a UserControl in C# Code from the guide below, which will demonstrate a real scenario for docking the Control in Windows Forms application. And Through the tutorial, users can put controls on various controls, dock the user control inside the Kettic Dock Control, and implement events, methods and properties to communication with forms or user controls. In the specific demo, a user control instance will be docked in a Kettic Dock Control instance. The following has more detailed steps.
  1. Create a new Windows Forms application in your Microsoft Visual Studio.
  2. Open Solution Explorer, right click the project node, choose Add - UserControl and name it as CalendarPanel. A new user control will be created.
  3. Drag a WinForms Calendar instance and drop it on the design surface of the created CalendarPanel.
  4. Change the property of the Dock of the WinForms Calendar control as Fill and create an event handler by locating the event of SelectionChanged and double clicking on it.
  5. Change the date selection, and add a delegate and event to be surfaced by using the CalendarPanel control. The following C# code shows how to configure the event.
  6. Open the design surface of the main form in the Solution Explorer and drag and drop a Dock instance on the design surface and configure the property of Dock as Fill.
  7. Copy and paste the C# code snippet to Form_Load event handler to Dock the CalendarPanel user control to Dock
  8. Use the following C# code snippet to add an event handler for the CalendarPanel DateChanged event:
  9. Debug the Windows Forms application and click the cells in the calendar to see if the date can be displayed in a message dialog.
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