下面的示例把 GridControl.MainView 的布局保存到系统注册表中,然后从中恢复。 在注册表中布局的完整路径是: HKEY_CURRENT_USER\DevExpress\XtraGrid\Layouts\MainLayout

C#CopyCode image复制代码
    string regKey = "DevExpress\\XtraGrid\\Layouts\\MainLayout";
    gridControl1.MainView.SaveLayoutToRegistry(regKey);
            
    //...

    gridControl1.MainView.RestoreLayoutFromRegistry(regKey);
Visual BasicCopyCode image复制代码
    Dim regKey As String = "DevExpress\XtraGrid\Layouts\MainLayout"
    gridControl1.MainView.SaveLayoutToRegistry(regKey)

    '...

    gridControl1.MainView.RestoreLayoutFromRegistry(regKey)