DevExpress gridControl 布局(Layout)保存与读取----3
把活动视图的布局保存到本地Xml文件中,使用SaveLayoutToXml 和 RestoreLayoutFromXml方法。
using DevExpress.XtraGrid; // ...string fileName = "c:\\XtraGrid_SaveLayoutToXML.xml"; privatevoid Form1_Load(object sender, System.EventArgs e)
{
gridControl1.ForceInitialize();
// Restore the previously saved layout
gridControl1.MainView.RestoreLayoutFromXml(fileName);
}
privatevoid Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
// Save the layout to an XML file
gridControl1.MainView.SaveLayoutToXml(fileName);
}
作者:十一_x
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。知识共享署名-非商业性使用-相同方式共享 2.5 中国大陆许可协议

浙公网安备 33010602011771号