下面的示例演示了如何把活动视图的布局 (在 XtraGrid 控件中) 保存到流中,然后恢复它。
C# | 复制代码 |
---|
System.IO.Stream str;
str = new System.IO.MemoryStream();
gridControl1.FocusedView.SaveLayoutToStream(str);
str.Seek(0, System.IO.SeekOrigin.Begin);
gridControl1.FocusedView.RestoreLayoutFromStream(str);
str.Seek(0, System.IO.SeekOrigin.Begin);
|
Visual Basic | 复制代码 |
---|
Dim str As System.IO.Stream
'...
' creating and saving the view's layout to a new memory stream
str = New System.IO.MemoryStream()
GridControl1.FocusedView.SaveLayoutToStream(str)
str.Seek(0, System.IO.SeekOrigin.Begin)
' ...
' loading the view's layout from a previously saved memory stream
GridControl1.FocusedView.RestoreLayoutFromStream(str)
str.Seek(0, System.IO.SeekOrigin.Begin)
|