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.
this.dockingManager1.SetEnableDocking(this.listView1,true);
Me.dockingManager1.SetEnableDocking(Me.listView1, True)
- Set the control as a non-dockable floating window.
this.dockingManager1.SetFloatOnly(this.listView1,true);
Me.dockingManager1.SetFloatOnly(Me.listView1,True)
- Determine whether the control is floating using the
IsFloating()
method.- If
true
, then the control is being hosted in a subclass of the Form type and this host form can be retrieved through the control’sTopLevelControl
property. - Once, we have the top level form, x and y co-ordinates can be retrieved using Control.Location property of that form.
- If
// 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())