39 //绑定DataTable
40 gridControl1.DataSource = dt;
41 gridView1.OptionsCustomization.AllowColumnMoving = false;//如何让各列头禁止移动
42 gridView1.OptionsCustomization.AllowFilter = false;//不允许过滤
43 gridView1.OptionsCustomization.AllowSort = false;//不允许排序
44 gridView1.OptionsCustomization.AllowGroup = false;//不允许分组
45 gridView1.OptionsView.ShowGroupPanel = false;//不显示组面板
46 gridView1.OptionsSelection.MultiSelect = true;//可以多选
47 gridView1.OptionsSelection.MultiSelectMode =
48 DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;//RowSelect; //选择模式MultiSelectMode = CheckBoxRowSelect,
49 gridView1.OptionsView.ColumnAutoWidth = true;//列宽自动
50 gridView1.OptionsCustomization.AllowColumnResizing = false;//不允许改变列宽
51 gridView1.OptionsBehavior.Editable = true;//允许编辑
52 gridView1.OptionsView.EnableAppearanceEvenRow = true;//设置奇、偶行交替颜色
53 gridView1.OptionsView.EnableAppearanceOddRow = true;//设置奇、偶行交替颜色
54 gridView1.Appearance.EvenRow.BackColor=Color.DeepSkyBlue;
55 gridView1.Appearance.OddRow.BackColor = Color.CornflowerBlue;
56 this.gridView1.IndicatorWidth = 30;//设置显示行号的列宽
57 MessageBox.Show((gridView1.GetDataRow(0)[0]).ToString ());//获取第二行第二列数据,下标从零开始