下列代码演示了如何把 BarManager 的状态保存到系统注册表中,以及从系统注册表中读取已保存的 BarManager 的状态。 Bars 布局的完整注册表路径是: HKEY_CURRENT_USER\DevExpress\XtraBars\States\MainState

C#CopyCode image复制代码
    string regKey = "DevExpress\\XtraBars\\States\\MainState";
    barManager1.SaveLayoutToRegistry(regKey);
            
    //...

    barManager1.RestoreLayoutFromRegistry(regKey);
Visual BasicCopyCode image复制代码
    Dim regKey As String = "DevExpress\XtraBars\States\MainState"
    BarManager1.SaveLayoutToRegistry(regKey)

    '...

    BarManager1.RestoreLayoutFromRegistry(regKey)