Back to Devexpress

How to: Save the layout of bars to the system registry

windowsforms-5418-controls-and-libraries-ribbon-bars-and-menu-examples-bars-how-to-save-the-layout-of-bars-to-the-system-registry.md

latest1.0 KB
Original Source

How to: Save the layout of bars to the system registry

  • Jan 18, 2019

Tip

You can utilize the Persistence Behavior or Workspace Manager component to save and restore layouts for all supported DevExpress controls at once.

The following code demonstrates how to write and read a BarManager’s state to/from the system registry. The full path for the bars layout will be: HKEY_CURRENT_USER\DevExpress\XtraBars\States\MainState.

csharp
string regKey = "DevExpress\\XtraBars\\States\\MainState";
    barManager1.SaveLayoutToRegistry(regKey);

    //...

    barManager1.RestoreLayoutFromRegistry(regKey);
vb
Dim regKey As String = "DevExpress\XtraBars\States\MainState"
    BarManager1.SaveLayoutToRegistry(regKey)

    '...

    BarManager1.RestoreLayoutFromRegistry(regKey)