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

Determining window dock location

Hi, I am using the docking manager to control my child windows. I am looking for a way to determine the window''s docked position at runtime. i.e docked to the left, top, right or bottom. thanks.

8 Replies

AD Administrator Syncfusion Team April 30, 2004 10:53 AM UTC

Hi Patrick, You could do so by accessing the DockInfo object associated with each docking window. The DockInfo object''s dStyle property specifies the DockingStyle and the rcDockArea specifies the rectangle that contains the docking window. Please refer to the code snippet below : Syncfusion.Windows.Forms.Tools.DockHost dhost = panel.Parent as Syncfusion.Windows.Forms.Tools.DockHost; Syncfusion.Windows.Forms.Tools.DockHostController dhc = dhost.InternalController as Syncfusion.Windows.Forms.Tools.DockHostController; Syncfusion.Windows.Forms.Tools.DockInfo di = dhc.GetSerCurrentDI(); left = di.rcDockArea.Left; top = di.rcDockArea.Top; bottom = di.rcDockArea.Bottom; right = di.rcDockArea.Right; string dockStyle = di.dStyle.ToString(); I have attached a complete sample here which illustrates the above. Let me know if you need any additional information. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team May 6, 2006 03:38 AM UTC

This seems to provide the information about where the control was docked, but not the control''s current information. For example, if I dock a control then resize it the information I get is about the size of the control when it docked and not the current size. Is there a way to get the DockInfo refreshed to the control''s current size? > >Syncfusion.Windows.Forms.Tools.DockHost dhost = panel.Parent as Syncfusion.Windows.Forms.Tools.DockHost; > Syncfusion.Windows.Forms.Tools.DockHostController dhc = dhost.InternalController as Syncfusion.Windows.Forms.Tools.DockHostController; > Syncfusion.Windows.Forms.Tools.DockInfo di = dhc.GetSerCurrentDI(); > > left = di.rcDockArea.Left; > top = di.rcDockArea.Top; > bottom = di.rcDockArea.Bottom; > right = di.rcDockArea.Right; > > string dockStyle = di.dStyle.ToString(); >


VS Vijayanand S Syncfusion Team May 6, 2006 02:27 PM UTC

Hi Don, You can get the current size and docking style of the Docked window using DockHostController.DICurrent property. dockwindow_position.zip Please take a look at the modified sample and let me know if it resolves your requirement. Thanks for using Syncfusion Products. Regards, Vijay


AD Administrator Syncfusion Team May 9, 2006 04:32 PM UTC

I took a look at the sample, but this does not give me the number I need to recreate the dock. I tried to modify your example to show what I mean but I can''t get it to dock a dynamically created panel. Maybe you can explain to me what is wrong with this code. I keep getting ArgumentOutOfRangeException when I try to dock it: (defined as part of Form1) private System.Windows.Forms.Panel panel3; (inserted in Form1 constructor after InitializeComponent()) panel3 = new Panel(); panel3.Name = "panel3"; dockingManager1.DockControl(panel3, this, Syncfusion.Windows.Forms.Tools.DockingStyle.Bottom, 200); dockingManager1.SetDockLabel(panel3, "panel3");


VS Vijayanand S Syncfusion Team May 10, 2006 06:30 AM UTC

Hi Don, Syncfusion Docking Manager loads/ initializes the docking windows properties and states after the Form Load event. If you want to create or get the properties of docking windows during application startup, you could use the statement within the NewDockStateEndLoad event. This event will trigger at the end of the Form Load event. Please take a look at this modified sample and let me know if this meets your requirements. Modified sample Thanks, Vijay


AD Administrator Syncfusion Team May 10, 2006 02:27 PM UTC

I see, thank you. Your new sample exposes the issue I have. Even though Panel3 is docked bottom with a size of 200, the rcDockArea says 196. What I am looking for is a way to get the 200 back out.


VS Vijayanand S Syncfusion Team May 10, 2006 02:58 PM UTC

Hi Don, Thanks for the update. DockingManager sets the control size after reducing the splitter width (Given size - SplitterWidth). DockingManager''s default splitter width is 4. That''s why it displays the actual control size as 196 eventhough the size is set as 200. Please let me know if you have any questions. Regards, Vijay


AD Administrator Syncfusion Team May 10, 2006 07:12 PM UTC

Perfect! Thanks, that is exactly what I needed.

Loader.
Live Chat Icon For mobile
Up arrow icon