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";
               
            }
        }

 

相关文章:

  • 2021-09-13
  • 2022-01-10
  • 2021-05-21
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
  • 2021-12-24
相关资源
相似解决方案