DEV GridControl ID相同的行显示相同的颜色(当ID的值不确定时)
基于DEV1.1.2?CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)存在BUG,經(jīng)過測試研究,使用以下方法
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;
}
}
}
總結(jié)
以上是生活随笔為你收集整理的DEV GridControl ID相同的行显示相同的颜色(当ID的值不确定时)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: POJ-3070 Fibonacci 快
- 下一篇: 《30天自制操作系统》前言、目录、样章欢