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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to determine when a docking window is transitioned on an MDIChild form others in WinForms Docking Manager?

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

Docking events

Usually MDIClient’s ControlAdded or ControlRemoved events are fired whenever an MDIChild form is added or removed. So, subscribing into these events are used to determine the state transitions. Please refer the below code snippet which illustrates this:

C#

foreach (Control ctrl in this.Controls)
{
   if (ctrl.GetType() == typeof(MdiClient))
   {
       ctrl.ControlAdded += new ControlEventHandler(this.MDIClient_ControlAdded);
       ctrl.ControlRemoved += new ControlEventHandler(this.MDIClient_ControlRemoved);
       break;
   }
}
protected void MDIClient_ControlAdded(object sender, ControlEventArgs e)
{
   if (e.Control is Syncfusion.Windows.Forms.Tools.DockingWrapperForm)
   {
       Console.WriteLine("Docking window to MDIChild transition");
   }
}
protected void MDIClient_ControlRemoved(object sender, ControlEventArgs e)
{
   if (e.Control is Syncfusion.Windows.Forms.Tools.DockingWrapperForm)
   {
       Console.WriteLine("MDIChild to Docking window transition");
   }
}

 

VB

For Each ctrl As Control In Me.Controls
    If ctrl.GetType() Is GetType(MdiClient) Then
       AddHandler ctrl.ControlAdded, AddressOf MDIClient_ControlAdded
       AddHandler ctrl.ControlRemoved, AddressOf MDIClient_ControlRemoved
    Exit For
End If
Next ctrl
Protected Sub MDIClient_ControlAdded(ByVal sender As Object, ByVal e As ControlEventArgs)
    If TypeOf e.Control Is Syncfusion.Windows.Forms.Tools.DockingWrapperForm Then
       Console.WriteLine("Docking window to MDIChild transition")
    End If
End Sub
Protected Sub MDIClient_ControlRemoved(ByVal sender As Object, ByVal e As ControlEventArgs)
    If TypeOf e.Control Is Syncfusion.Windows.Forms.Tools.DockingWrapperForm Then
       Console.WriteLine("MDIChild to Docking window transition")
    End If
End Sub

 

Sample: http://help.syncfusion.com/support/samples/kb/Tools.Windows/TDSTrans/StateTransition.zip

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