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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Persisting DockingManager control sizes

Thread ID:





27262 Apr 8,2005 12:34 PM UTC Apr 11,2005 07:41 PM UTC WinForms 2
Tags: Tools
Peter Moss
Asked On April 8, 2005 12:34 PM UTC

I am trying to persist the width of a GroupBar panel docked inside a DockingManager instance across sessions. I am aware of the DockingManager.PersistState flag, but I need to control the location of the state because of other requirements that are too arcane to describe. In my Form.OnClosing() override I save the width of the GroupBar Control. OK so far. During Form.OnLoad() I tried to restore the width using DockingManager.SetControlSize() but this didn''t work. I sort of got something to work by setting a state flag and then calling SetControlSize() in one of the OnActivated() calls. But then if I create another instance of the main Form, things don''t work. My question is. If I know the desired width of a docked Control, what is the best way to re-initialize this size when the Form is created?

Administrator [Syncfusion]
Replied On April 8, 2005 03:39 PM UTC

Hi Peter, I''d recommend looking into the LoadDockState() and SaveDockState() methods in DockingManager. They should provide you with the control over persistance that you''re looking for. Please let me know if you have any questions regarding the use of these methods. Regards, Gregory Austin Syncfusion Inc.

Peter Moss
Replied On April 11, 2005 07:41 PM UTC

Gregory, Thank you for the tip. That is what I ended up doing. The one subtle point is that after loading the state (duing the Form.OnLoad() override), I had to call dockingManager.RecalcHostFormLayout() because otherwise the contained Control had the default designer width instead of the full width of the splitter bar. Here is some code that I am using in case anyone else is interested: private void SerializeDockingManagerState(bool bSave) { string dockingManagerStatePath = AbdUtils.PathAppend2(AbdUtils.GetUserSettingsPath(false), @"DockingManagerState.xml"); try { if (bSave) { using (FileStream fs = new FileStream(dockingManagerStatePath, FileMode.Create, FileAccess.ReadWrite)) { Syncfusion.Runtime.Serialization.AppStateSerializer ser = new Syncfusion.Runtime.Serialization.AppStateSerializer(Syncfusion.Runtime.Serialization.SerializeMode.XMLFmtStream, fs); dockingManager.SaveDockState(ser); ser.PersistNow(); fs.Close(); } } else { using (FileStream fs = new FileStream(dockingManagerStatePath, FileMode.Open, FileAccess.ReadWrite)) { Syncfusion.Runtime.Serialization.AppStateSerializer ser = new Syncfusion.Runtime.Serialization.AppStateSerializer(Syncfusion.Runtime.Serialization.SerializeMode.XMLFmtStream, fs); dockingManager.LoadDockState(ser); } // I found I needed to call this because the containd GroupBar control is not resized to the proper splitter bar position/width dockingManager.RecalcHostFormLayout(); } } catch (Exception e) { s_log.Warn("SerializeDockingManagerState AppStateSerializer error.", e); } }


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon