DevComponents.com

How To Save Default Docking Layout

Following code can be used in Form Load event to save default layout to a string:

private void SaveDefaultLayout()
{
    ArrayList customBars = new ArrayList();
    foreach (Bar bar in dotNetBarManager1.Bars)
    {
        if (!bar.CustomBar)
        {
            bar.CustomBar = true;
            customBars.Add(bar);
        }
    }
    m_DefaultLayout = dotNetBarManager1.LayoutDefinition;
 
    foreach (Bar bar in customBars)
    {
        bar.CustomBar = false;
    }
}

DotNetBarManager1.SaveLayout can also be used to save layout to a file instead of accessing DotNetBarManager1.LayoutDefinition.

To load the default layout saved this way you can use following code:

if (m_DefaultLayout != "")
    dotNetBarManager1.LayoutDefinition = m_DefaultLayout;

You can use DotNetBarManager1.LoadLayout to load layout from file instead from the string as in sample above.

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favoritesAdd to favorites

User Opinions (8 votes)

62% thumbs up 37% thumbs down

How would you rate this answer?

Helpful
Not helpful
Thank you for rating this answer.

Related Questions

No related questions were found.

Attachments

No attachments were found.