可以用FetchCellStyle事件来设置,需要注意的是,要将这个DisplayCloumn的FetchStyle属性设置为true
- private void c1TrueDBGrid1_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e)
- {
- if(e.Row==0)
- e.CellStyle.BackColor = Color.FromArgb(255, 222, 255);
- if (e.Row == 1)
- e.CellStyle.BackColor = Color.FromArgb(222, 255, 255);
- if (e.Row == 2)
- e.CellStyle.BackColor = Color.FromArgb(255, 255, 222);
- }
复制代码 |