Back to Devexpress

How to: Save and restore layout

windowsforms-2209-controls-and-libraries-form-layout-managers-layout-and-data-layout-controls-examples-how-to-save-and-restore-layout.md

latest755 B
Original Source

How to: Save and restore layout

  • Nov 13, 2018

The following sample code saves the current layout to a memory stream and then restores it.

csharp
System.IO.Stream stream;
stream = new System.IO.MemoryStream();
layoutControl1.SaveLayoutToStream(stream);
stream.Seek(0, System.IO.SeekOrigin.Begin);

// ...
layoutControl1.RestoreLayoutFromStream(stream);
stream.Seek(0, System.IO.SeekOrigin.Begin);
vb
Dim stream As System.IO.Stream
stream = New System.IO.MemoryStream()
LayoutControl1.SaveLayoutToStream(stream)
stream.Seek(0, System.IO.SeekOrigin.Begin)

' ...
LayoutControl1.RestoreLayoutFromStream(stream)
stream.Seek(0, System.IO.SeekOrigin.Begin)