Hi,
I need to create a floating window that can be dockable. I use this code:
mDockingManager.SetEnableDocking(myForm, true);
mDockingManager.FloatControl(form, new Rectangle(location.X, location.Y, width, height));
It seems that the method SetEnableDocking dock my form at left and display it before changing it to a floating window (I can see flicker of the docking operation). I wonder if it possible to directly display my floating window without being firstly docked implicitly by the dock manager.
I was able to reduce the flicker by using these methods:
mDockingManager.LockHostFormUpdate();
mDockingManager.LockDockPanelsUpdate();
//my code ...
mDockingManager.UnlockHostFormUpdate();
mDockingManager.UnlockDockPanelsUpdate();
but maybe there is a much "cleaner" way to do it.
Thank you
Jonathan
GS
Githanjali S
Syncfusion Team
December 9, 2009 06:42 AM UTC
Hi Jonathan,
For a floating window to be directly displayed without being docked to the docking manager at first,the following code is sufficient:
dockingManager1.FloatControl(panel1, new Rectangle(30,30,300,300));
You can later dock the control by double clicking on the caption or right click on the caption.
Currently LockHostFormUpdate and UnlockHostFormUpdate are the available methods to prevent flickering.
Regards,
Githanjali
JR
Jonathan Richard
December 9, 2009 02:22 PM UTC
Hi,
the call of mDockingManager.FloatControl (without calling m.DockManager.SetEnableDocking before) seems to work with a simple control (e.g. a textbox) but when I try with a form an exception is raised. It says "cannot add a first level control into a control". Thank you
Jonathan
JR
Jonathan Richard
December 9, 2009 04:09 PM UTC
Hi,
It seems that this is the mDockingManager.LockDockPanelsUpdate() and not the mDockingManager.LockHostForm() that avoid flicker when opening a floating window. However it may cause unwanted behavior if the operation between the lock and unlock calls is too long (e.g. windows that are behind the application are drawn over the application during an instant!). This is a really bad side effect so I think there should be cleaner way to open a dockable form as floating window without having to twick the draw. Do you think that you could correct this behavior soon? For example the SetEnableDocking method may support a visibility parameters. Thank you
Jonathan
JR
Jonathan Richard
December 9, 2009 07:43 PM UTC
Hi,
Ok the call:
dockingManager1.FloatControl(ctrl, new Rectangle(30,30,300,300));
work on UserControl. I'm studying the possibility of creating my windows with UserControl instead of WinForms. In that way it may be more compatible with your docking manager. Don't you think? thank you
Jonathan
GS
Githanjali S
Syncfusion Team
December 10, 2009 10:09 AM UTC
Hi Jonathan,
You could use the following steps to make a floating form to be directly displayed without being docked to the docking manager at first,
Form2 frm = new Form2();
frm.FormBorderStyle = FormBorderStyle.None;
frm.TopLevel = false;
this.dockingManager1.SetEnableDocking(frm,true);
this.dockingManager1.SetAsMDIChild(frm,true);
this.dockingManager1.FloatControl(frm, new Rectangle(30, 30, 300, 300));
Regards,
Githanjali