Articles in this section
Category / Section

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

1 min read

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: https://help.syncfusion.com/support/samples/kb/Tools.Windows/TDSTrans/StateTransition.zip

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied