Back to Devexpress

How to: Save the Control Layout to the Registry and Then Restore It

windowsforms-4882-controls-and-libraries-navigation-controls-navigation-bar-examples-miscellaneous-how-to-save-the-control-layout-to-the-registry-and-then-restore-it.md

latest1.4 KB
Original Source

How to: Save the Control Layout to the Registry and Then Restore It

  • Nov 13, 2018

The following sample code demonstrates a way in which to save control layout to the registry and then restore it. The NavBarControl.SaveToRegistry and NavBarControl.RestoreFromRegistry methods are used for this purpose.

The image below displays two NavBarControl controls before and after code execution. Note that the second control is initially empty (it doesn’t contain any groups and items). Layout information of the first control is saved to the registry. The second control restores it. Note that only the layout of groups and links is saved.

csharp
navBarControl1.SaveToRegistry(
  "HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\NavBarLayout");
navBarControl2.RestoreFromRegistry(
  "HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\NavBarLayout");
vb
NavBarControl1.SaveToRegistry( _
  "HKEY_LOCAL_MACHINE\SOFTWARE\DevExpress Inc\NavBarLayout")
NavBarControl2.RestoreFromRegistry( _
  "HKEY_LOCAL_MACHINE\SOFTWARE\DevExpress Inc\NavBarLayout")