DevExpress gridControl 布局(Layout)保存与读取----2

下面的示例代码把活动视图的布局保存到内存流中,然后从中恢复。 使用了BaseView.SaveLayoutToStream 和 BaseView.RestoreLayoutFromStream 方法。

System.IO.Stream stream;
    // 创建并保存视图布局到内存流中
str = new System.IO.MemoryStream();
gridControl1.KeyboardFocusView.SaveLayoutToStream(stream);
str.Seek(0, System.IO.SeekOrigin.Begin);
    //还原视图布局
gridControl1.KeyboardFocusView.RestoreLayoutFromStream(stream);
str.Seek(0, System.IO.SeekOrigin.Begin);
当然,你可以把流保存到数据库中,这样就更方便了。
posted @ 2011-05-13 17:19  十一_x  阅读(3996)  评论(0编辑  收藏  举报