string style = "";
private void gridView1_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
{
  if (e.Column.FieldName == "单价类型")//设背景
  {
    style = e.CellValue.ToString(); ;
  }
  if (e.Column.FieldName == "吨价")
  {
    if (style == "条价" )
    {
      e.Appearance.BackColor = Color.FromArgb(235, 235, 235);
    }
  }
  if (e.Column.FieldName == "条价")
  {
    if (style == "吨价" )
    {
      e.Appearance.BackColor = Color.FromArgb(235, 235, 235);
    }
  }
}

 

设置全局变量保存循环的行的指定单元格的值(事件自动循环),根据值的改变来改变其他单元格的格式。