基于DEV1.1.2 CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)存在BUG,经过测试研究,使用以下方法
private void gridViewCarList_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
{
DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
if (e.RowHandle >= 0)
{
string id = view.GetRowCellDisplayText(e.RowHandle, this.colRowCountID);
if (Convert.ToInt32(id) % 3 == 1)
{
e.CellStyle.BackColor = Color.Bisque;
}
if (Convert.ToInt32(id) % 3 == 2)
{
e.CellStyle.BackColor = Color.CornflowerBlue;
}
if (Convert.ToInt32(id) % 3 == 0)
{
e.CellStyle.BackColor = Color.White;
}
}
}