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

How to save/load the state information in a form which contains both the TabbedMDIManager and the DockingManager?

Platform: WinForms |
Control: DockingManager |
Published Date: April 30, 2011 |
Last Revised Date: July 10, 2014

 

In General, the MDIChild states are maintained by the TabbedMDIManager. The DockingManager persists information about whether a particular window is an MDIChild or not. Hence the DockingManager’s PersistState property will not persist the TabbedMDI state and this has to be done through the TabbedMDIManager’s SaveTabGroupStates or LoadTabGroupStates methods.

SaveTabGroupStates:

It is always better to call the TabbedMDIManager’s SaveTabGroupStates method, from Form.WndProc method. This has to be done in response to the WM_CLOSE message. This will force the TabbedMDIManager to persist the MDIChild state before the DockingManager has a chance to clear it up.

LoadTabGroupStates:

The TabbedMDIManager’s LoadTabGroupStates method should be invoked from the DockingManager’s NewDockStateEndLoad event. This event get fired after the docking windows state has been loaded.

Now the persisted TabbedMDI state should be applied to MDIChild forms. Please refe rthe below code snippet which illustrates this:

C#

protected override void WndProc(ref Message m)

{

if(m.Msg == 0x0010/*WM_CLOSE*/)

{

// Save the TabbedMDIManager state before the Form gets a chance to generate the Closing event

this.tabbedMDIManager.SaveTabGroupStates();

}

base.WndProc(ref m);

}

private void dockingManager1_NewDockStateEndLoad(object sender, System.EventArgs e)

{

this.tabbedMDIManager.LoadTabGroupStates();

}

VB

Protected Overrides Sub WndProc(ByRef m As Message)

if(m.Msg == 0x0010/*WM_CLOSE*/)

If m.Msg = &H0010 Then

' Save the TabbedMDIManager state before the Form gets a chance to generate the Closing event

Me.tabbedMDIManager.SaveTabGroupStates()

End If

MyBase.WndProc(m)

End Sub

Private Sub dockingManager1_NewDockStateEndLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles dockingManager1.NewDockStateEndLoad

Me.tabbedMDIManager.LoadTabGroupStates()

End Sub

Sample:

http://help.syncfusion.com/support/samples/KB/Tools.Windows/TDDockTab/DockTab.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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