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

C#

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;
}

VB

Private Sub SaveDefaultLayout()
    Dim customBars As New ArrayList()
 
    For Each bar As Bar In dotNetBarManager1.Bars
        If Not bar.CustomBar Then
            bar.CustomBar = True
 
            customBars.Add(bar)
        End If
    Next
 
    m_DefaultLayout = dotNetBarManager1.LayoutDefinition
 
    For Each bar As Bar In customBars
        bar.CustomBar = False
    Next
End Sub

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:

C#

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

VB

If m_DefaultLayout <> "" Then
	dotNetBarManager1.LayoutDefinition = m_DefaultLayout
End If

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

Related posts:

  1. How to load default DotNetBarManager definition
  2. Docking Concepts
  3. Saving/Loading User Definitions
  4. Working with DotNetBar from code.
  5. How To Create Table Layout With Text-Markup