下面的示例代码展示了如何在运行时刻保存和加载一个网格视图的布局。

C#CopyCode image复制代码
string fileName = "c:\\XtraGrid_SaveLayoutToXML.xml";
gridView1.SaveLayoutToXml(fileName);
// ...
gridView1.RestoreLayoutFromXml(fileName);

Visual BasicCopyCode image复制代码

Dim fileName As String = "c:\XtraGrid_SaveLayoutToXML.xml"
gridView1.SaveLayoutToXml(fileName)
' ...
GridView1.RestoreLayoutFromXml(fileName)