We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get or set the docking state for a docked control on loading the application in WinForms Docking Manager?

Platform: WinForms |
Control: DockingManager |
Published Date: April 30, 2011 |
Last Revised Date: December 6, 2019

Docking state

Before closing a docked/floating control, access the control’s parent and cast this to type Syncfusion.Windows.Forms.Tools.DockHost. Now access the DockHost’s InternalController and get its current serialization information through the GetSerCurrInfo() method.

This will return an object of type Syncfusion.Windows.Forms.Tools.DockInfo. The DockInfo.DockingStyle member gives the dock position of the particular control with respect to the host form and the DockInfo.rcDockArea member returns the control bounds.

If the control is floating, then DockingStyle will be equal to Syncfusion.Windows.Forms.Tools.DockingStyle.Fill.

You can serialize this information against the control’s name, and later upon loading, appropriately use either the DockingManager.DockControl() / FloatControl() method based on the serialized DockingStyle/rcbounds values to set the control’s dock state.

Please refer to the code sample below which shows how the DockInfo object can be captured:

C#

// Suppose listView1 is the dockable control
Syncfusion.Windows.Forms.Tools.DockHost dhost = this.listView1.Parent as Syncfusion.Windows.Forms.Tools.DockHost;
Syncfusion.Windows.Forms.Tools.DockHostController dhc = dhost.InternalController as Syncfusion.Windows.Forms.Tools.DockHostController;
Syncfusion.Windows.Forms.Tools.DockInfo di = dhc.GetSerCurrentDI();

 

VB

' Suppose listView1 is the dockable control
Dim dhost As Syncfusion.Windows.Forms.Tools.DockHost = Me.listView1.Parent as Syncfusion.Windows.Forms.Tools.DockHost
Dim dhc As Syncfusion.Windows.Forms.Tools.DockHostController = dhost.InternalController as Syncfusion.Windows.Forms.Tools.DockHostController
Dim di As Syncfusion.Windows.Forms.Tools.DockInfo = dhc.GetSerCurrentDI()

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon