You can use the SaveControlStateToStream and LoadControlStateToStream methods to load/save the entire chart control state to a stream. This is how it's done:
| C# |
Copy Code
|
|---|---|
MemoryStream memoryStream = new MemoryStream(); // save the control state chartControl.Serializer.SaveControlStateToStream(memoryStream, PersistencyFormat.Binary, null); // load the controls state memoryStream.Position = 0; chartControl.Serializer.LoadControlStateFromStream(memoryStream, PersistencyFormat.Binary, null); |
|
| Visual Basic |
Copy Code
|
|---|---|
Dim memoryStream As New MemoryStream ' save the control state chartControl.Serializer.SaveControlStateToStream(memoryStream, PersistencyFormat.Binary, Nothing) ' load the controls state memoryStream.Position = 0 chartControl.Serializer.LoadControlStateFromStream(memoryStream, PersistencyFormat.Binary, Nothing) |
|
Note that you have to reset the stream position before loading the state:
| C# |
Copy Code
|
|---|---|
// go back to the beginning of the stream
memoryStream.Position = 0;
|
|
| Visual Basic |
Copy Code
|
|---|---|
' go back to the beginning of the stream
memoryStream.Position = 0
|
|