下列代码演示了如何把停靠布局写入内存,并且从内存中读取布局。

C#CopyCode image复制代码
System.IO.Stream stream = new System.IO.MemoryStream();
dockManager1.SaveLayoutToStream(stream);
// Set the stream pointer to the beginning.
stream.Seek(0, System.IO.SeekOrigin.Begin);

// ...

dockManager1.RestoreLayoutFromStream(stream);
// Set the stream pointer to the beginning.
stream.Seek(0, System.IO.SeekOrigin.Begin);
Visual BasicCopyCode image复制代码
Dim stream As System.IO.Stream
stream = New System.IO.MemoryStream()
DockManager1.SaveToStream(stream)
' Set the stream pointer to the beginning.
stream.Seek(0, System.IO.SeekOrigin.Begin)

' ...

DockManager1.RestoreFromStream(stream)
' Set the stream pointer to the beginning.
stream.Seek(0, System.IO.SeekOrigin.Begin)