A newer version of this page is available. Switch to the current version.

How to: Save a control's layout to the system registry

The following sample code demonstrates a way of saving a view's layout (in XtraGrid) to a specific system registry path and then restoring it.

You can define absolute and relative registry keys as the parameter. For example, specifying "Software\MyCompany\MyProject" as a partial key will result in saving the settings to the "HKEY_CURRENT_USER\Software\MyCompany\MyProject" path. You can also specify the entire key if you need to store the layout to another root key.

string regKey = "DevExpress\\XtraGrid\\Layouts\\MainLayout";
// ...