How to get individual floating controls properties?
9 Dec 20192 minutes to read
To get the x,y coordinates of the control if it is in floating state,
- Add a list view and a docking manager to your form.
- Enable the list view as a dock control.
- Set the control as a non-dockable floating window.
- Determine whether the control is floating using the
true, then the control is being hosted in a subclass of the Form type and this host form can be retrieved through the control’s
- Once, we have the top level form, x and y co-ordinates can be retrieved using Control.Location property of that form.
// Get the FloatingForm object to get location of control.FloatingForm is a Form derived class. DockHost dockHost = this.listView1.Parent as Syncfusion.Windows.Forms.Tools.DockHost; FloatingForm floatForm = dockHost.ParentForm as FloatingForm; MessageBox.Show(floatForm.Location.ToString());
' Get the FloatingForm object to get location of control.FloatingForm is a Form derived class. Dim dockHost As DockHost = CType(IIf(TypeOf Me.listView1.Parent Is Syncfusion.Windows.Forms.Tools.DockHost, Me.listView1.Parent, Nothing), Syncfusion.Windows.Forms.Tools.DockHost) Dim floatForm As FloatingForm = CType(IIf(TypeOf dockHost.ParentForm Is FloatingForm, dockHost.ParentForm, Nothing), FloatingForm) MessageBox.Show(floatForm.Location.ToString())