Back to Devexpress

How to: Save and Restore a Layout

windowsforms-3093-controls-and-libraries-chart-control-examples-producing-output-how-to-save-and-restore-a-layout.md

latest825 B
Original Source

How to: Save and Restore a Layout

  • Nov 13, 2018

The following example demonstrates how to save a chart to a memory stream, and then restore it.

csharp
using System.IO;
// ...

Stream stream = new MemoryStream();
// ...

// Save the chart.
stream.Seek(0, System.IO.SeekOrigin.Begin);
chartControl1.SaveToStream(stream);

// Load the chart.
stream.Seek(0, System.IO.SeekOrigin.Begin);
chartControl1.LoadFromStream(stream);
vb
Imports System.IO
' ...

Dim stream As System.IO.Stream
stream = New System.IO.MemoryStream()
' ...

' Save the chart.
stream.Seek(0, System.IO.SeekOrigin.Begin)
ChartControl1.SaveToStream(stream)

' Load the chart.
stream.Seek(0, System.IO.SeekOrigin.Begin)
ChartControl1.LoadFromStream(stream)