下列代码演示了如何使用 System.IO.MemoryStream 类把 BarManager 的状态写入流中,以及从流中读取已写入的 BarManager 的状态。
C# | 复制代码 |
---|
System.IO.Stream stream = new System.IO.MemoryStream();
barManager1.SaveLayoutToStream(stream);
stream.Seek(0, System.IO.SeekOrigin.Begin);
barManager1.RestoreLayoutFromStream(stream);
stream.Seek(0, System.IO.SeekOrigin.Begin);
|
Visual Basic | 复制代码 |
---|
Dim stream As System.IO.Stream
stream = New System.IO.MemoryStream()
BarManager1.SaveLayoutToStream(stream)
stream.Seek(0, System.IO.SeekOrigin.Begin)
BarManager1.RestoreLayoutFromStream(stream)
stream.Seek(0, System.IO.SeekOrigin.Begin)
|