GridView.CustomDrawCell事件可以对GridView展示的列进行处理.
gridView1.CustomDrawCell += gridView1_CustomDrawCell;
void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
{
if (e.Column.FieldName == "Status")
{
if (e.CellValue != null)
{
string s = e.CellValue.ToString();
switch (e.CellValue.ToString())
{
case "True": e.DisplayText = "是"; break;
case "False": e.DisplayText = "否"; break;
default: break;
}
}
}
}
//获得选中行的某列值
gridView1.GetDataRow(gridView1.FocusedRowHandle)["ID"].ToString();