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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to detect if FloatingWindow close button is clicked?

Close button of Floating window clicked event can detected from the VisibleChanged event of FloatingForm. Here we get the FloatingForm on DockStateChanged event. VisibleChanged event of FloatingForm will be raised when we click the close button. The following code demonstrates the same.



//Initialize the Panels
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
//Docking VisualStyle
this.dockingManager1.VisualStyle = VisualStyle.Metro;
//For Docking Panels
this.dockingManager1.SetDockLabel(this.panel1, "panel1");
this.dockingManager1.SetEnableDocking(this.panel1, true);
this.dockingManager1.SetDockLabel(this.panel2, "panel2");
this.dockingManager1.SetEnableDocking(this.panel2, true);
this.dockingManager1.SetDockLabel(this.panel3, "panel");
this.dockingManager1.SetEnableDocking(this.panel3, true);
//For Getting Floating Form
this.dockingManager1.DockStateChanged += dockingManager1_DockStateChanged;
void dockingManager1_DockStateChanged(object sender, Syncfusion.Windows.Forms.Tools.DockStateChangeEventArgs arg)
if (this.dockingManager1.IsFloating(arg.Controls[0]))
if (arg.Controls[0].TopLevelControl != null && arg.Controls[0].TopLevelControl is FloatingForm)
//For Close Button clicked on Floating Form
(arg.Controls[0].TopLevelControl as FloatingForm).VisibleChanged += Form1_VisibleChanged;
bool CloseButtonClicked=false;
void Form1_VisibleChanged(object sender, EventArgs e)
CloseButtonClicked = true;



'Initialize the Panels
Me.panel1 = New System.Windows.Forms.Panel()
Me.panel2 = New System.Windows.Forms.Panel()
Me.panel3 = New System.Windows.Forms.Panel()
'Docking VisualStyle
Me.dockingManager1.VisualStyle = VisualStyle.Metro
'For Docking Panels
Me.dockingManager1.SetDockLabel(Me.panel1, "panel1")
Me.dockingManager1.SetEnableDocking(Me.panel1, True)
Me.dockingManager1.SetDockLabel(Me.panel2, "panel2")
Me.dockingManager1.SetEnableDocking(Me.panel2, True)
Me.dockingManager1.SetDockLabel(Me.panel3, "panel")
Me.dockingManager1.SetEnableDocking(Me.panel3, True)
'For Getting Floating Form
AddHandler Me.dockingManager1.DockStateChanged, AddressOf dockingManager1_DockStateChanged
void dockingManager1_DockStateChanged(Object sender, Syncfusion.Windows.Forms.Tools.DockStateChangeEventArgs arg)
If True Then
If Me.dockingManager1.IsFloating(arg.Controls(0)) Then
If arg.Controls(0).TopLevelControl IsNot Nothing AndAlso TypeOf arg.Controls(0).TopLevelControl Is FloatingForm Then
'For Close Button clicked on Floating Form
AddHandler TryCast(arg.Controls(0).TopLevelControl, FloatingForm).VisibleChanged, AddressOf Form1_VisibleChanged
End If
End If
End If
Dim CloseButtonClicked As Boolean=False
void Form1_VisibleChanged(Object sender, EventArgs e)
If True Then
CloseButtonClicked = True
End If






Showing close button is clicked



C#: DockingManagerSample


VB: DockingManagerSample

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
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