GridView总结:

获取任何一级别中GridView所选中的数据行.

GridView gView = gridControl.FocusedView as GridView;//選中的GridViewint[] rows = gView.GetSelectedRows(); //選中的行

有時需要根據條件設置某一個單元格未只讀:

private void gridView9_ShowingEditor(object sender, CancelEventArgs e){ DevExpress.XtraGrid.Views.Grid.GridView gv = gridControl1.FocusedView as DevExpress.XtraGrid.Views.Grid.GridView; if (gv.FocusedColumn== gridColumn1) { MyList myList = gv.DataSource as MyList; if (myList == null) return; My my = myList[gv.FocusedRowHandle] as My; if (my == null) return; if(true)//條件 e.Cancel = true; } }