Docking manager floating

I have an application that uses docking manager to dock the forms. I need to resize the form when the form is floating (only when the form is floating) and position it in the centre of the screen. Kindly let me know how to do this

6 Replies

VS Vijayanand S Syncfusion Team December 1, 2005 12:09 PM UTC

Hi Rohith, 1. We can achieve non-resizable docking windows by setting the FreezeResize property to true. Currently, Syncfusion Docking manager can only support this property for all docked controls. So it is not possible to resize the window only for floating forms since docking and floating windows are controlled by the docking manager. We have already logged a feature request for this. I will increase the priority to address this issue soon. FreezeResize property for Each docking control 2. We can get the floating form properties using the following code snippet. DockHost dhost = dockedform as Syncfusion.Windows.Forms.Tools.DockHost; FloatingForm floatfrm = dhost.ParentForm as FloatingForm; floatfrm.Location=new Point(this.Size.Width/2-floatfrm.Width/2,this.Size.Height/2-floatfrm.Height/2); This allows you to easily change the location of the floating window. If you want to locate the window at the center whenever it changes from docking to floating, you can give the above coding in the DockStateChanged event. Please take a look at the attached sample which illustrates the above functionality and let me know if you have any questions. Thanks for your interest in Syncfusion products. Regards, Vijay Test Sample


AD Administrator Syncfusion Team December 1, 2005 12:31 PM UTC

Hi Vijay, Thanks. The sample changes the position to the centre of the screen on floating. but When I again Dock this control, the application it throws an exception.I need the ability to Dock and float the control whenever i need, at the same time when the form is floating I need to position it at the centre of screen.Kindly let me know the work around for this. Regards Rohith


VS Vijayanand S Syncfusion Team December 1, 2005 12:47 PM UTC

Hi Rohith, I am afraid, I was not able to reproduce your problem. Please clarify me the following: 1. Are you getting the exception by double clicking on the caption bar of the docking window? 2. Or, Do you use to redock and float the window by programmatically? If yes, Could you please provide me the code snippet? 3. And also can you send me the stack trace of the exception? Thanks for using Syncfusion Products. Regards, Vijay


AD Administrator Syncfusion Team December 1, 2005 01:00 PM UTC

Hi Vijay, I make the window floating by using the context menu option. (By right clicking on the title bar of the Docked form). Now when the form is floating and it is in the centre of the screen, I again right click on the title bar and using context menu option i choose the Dockable option.(Now the Dockable menu item will be tick marked in the context menu). Then again I choose the Dockable option. Now the application throws an exception.(object reference not set to an instance of an object in dockingManager1_DockStateChanged event handler). This problem does not occur when i double click on the title bar. Thanks Rohith.


VS Vijayanand S Syncfusion Team December 1, 2005 02:12 PM UTC

Hi Rohith, Sorry for the inconvenience. I have missed one condition to include in my sample. You could replace the following code instead of the old one. private void dockingManager1_DockStateChanged(object sender, Syncfusion.Windows.Forms.Tools.DockStateChangeEventArgs arg) { //Returns the boolean value whether it is floating or not. if(this.dockingManager1.IsFloating(arg.Controls[0])&& !(arg.Controls[0].Parent is DockingWrapperForm)) { //You could change the location or any other floating form properties. DockHost dhost = arg.Controls[0].Parent as Syncfusion.Windows.Forms.Tools.DockHost; FloatingForm floatfrm = dhost.ParentForm as FloatingForm; floatfrm.Location=new Point(this.Size.Width/2-floatfrm.Width/2,this.Size.Height/2-floatfrm.Height/2); } } Please let me know how it goes. Thanks for your cooperation. Regards, Vijay


AD Administrator Syncfusion Team December 1, 2005 02:31 PM UTC

Thanks Vijay. It helps

Loader.
Up arrow icon