[C#] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Design;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid;
namespace DevExpress1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Columnadd();
string fileName = @"G:\My Documents\Visual Studio 2010\Projects\DevExpress1\DevExpress1\1.xml";
gridControl1.ForceInitialize();
gridControl1.MainView.RestoreLayoutFromXml(fileName);
}
private void Columnadd()
{
GridColumn addColid = gridView1.Columns.AddField("col1");
addColid.Caption = "列1";
addColid.VisibleIndex = 0;
GridColumn addColmIcon = gridView1.Columns.AddField("col2");
addColmIcon.Caption = "列2";
addColmIcon.VisibleIndex = 1;
GridColumn addColm3 = gridView1.Columns.AddField("col3");
addColm3.Caption = "列3";
addColm3.VisibleIndex = 2;
}
}
}
为什么没有从xml加载到布局.??? |