需求:開發時遇到一個問題, 需要根據GridControl行數據不同,實現不同的效果
在gridView的RowCellStyle的事件中實現,需要的效果
private void gridView1_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
{
string accountQuantity = gridView1.GetRowCellValue(e.RowHandle, "ACCOUNT_QUANTITY").ToString();
string actualQuantity = gridView1.GetRowCellValue(e.RowHandle, "ACTUAL_QUANTITY").ToString();
if (accountQuantity != actualQuantity)
{
// e.Appearance.BackColor = Color.Red;//改變背景色
e.Appearance.ForeColor = Color.Red;//改變字體顏色
}
}