Dev-gridview-单元格绘制

gridView1_CustomDrawCell与gridView1_RowCellStyle都可以且用法一样。但是CustomDrawCell更稳定

 private void gridView1_CustomDrawCell(object sender, RowCellStyleEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
            //列名=a,值=1的标记为绿色
            if (e.CellValue.ToString() == "1" && e.Column.FieldName.ToString().Equals("a"))
            {
                e.Appearance.BackColor = Color.FromArgb(128, 255, 128);
                e.Column.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
               
            }
        }
原文地址:https://www.cnblogs.com/lhlong/p/4875039.html