You can use QueryCellInfo to set conditionally set the backcolors of cells. Here is code that will color columns 1 and 3 red if teh value in column 3 is larger than 30.
private void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if(e.ColIndex > 0 && e.RowIndex > 0)
{
e.Style.CellValue = this.table.Rows[e.RowIndex-1][e.ColIndex-1];
e.Handled = true;
if(e.ColIndex == 3)
{
double d;
if(double.TryParse(e.Style.Text, System.Globalization.NumberStyles.Any,
null, out d) && d > 30)
{
e.Style.BackColor = Color.Red;
}
}
else if(e.ColIndex == 1)
{
double d;
if(double.TryParse(this.grid[e.RowIndex, 3].Text,
System.Globalization.NumberStyles.Any, null, out d) && d > 30)
{
e.Style.BackColor = Color.Red;
}
}
}
}
One other thing, when you change teh value in column 3, you would want to make sure column 1 wa redrawn so it would reflect an y new color determined by the new value in column 3. You can do this in SaveCellInfo.
private void grid_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
{
if(e.ColIndex > 0 && e.RowIndex > 0)
{
this.table.Rows[e.RowIndex-1][e.ColIndex-1] = e.Style.CellValue;
e.Handled = true;
if(e.ColIndex == 3)
this.grid.Invalidate(grid.RangeInfoToRectangle(GridRangeInfo.Cell(e.RowIndex, 1)));
}
}