Try this code.
private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
if ((e.Inner.ColIndex == 2) || (e.Inner.ColIndex == 3))
{
if (e.Inner.Style.Text == "0")
e.Inner.Style.Text = "";
}
GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
if(SumMatches(style))
e.Inner.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, Color.Red);
}
private bool SumMatches(GridTableCellStyleInfo style)
{
if(style.TableCellIdentity.TableCellType != GridTableCellType.RecordFieldCell
&& style.TableCellIdentity.TableCellType != GridTableCellType.AlternateRecordFieldCell
|| (style.TableCellIdentity.DisplayElement.ParentRecord == null))
return false;
GridRecord rec = style.TableCellIdentity.DisplayElement.ParentRecord as GridRecord;
int index = this.gridGroupingControl1.Table.FilteredRecords.IndexOf(rec);
double sum1 = 0;
double sum2 = 0;
for(int i = 0; i <= index; ++i)
{
Record r = this.gridGroupingControl1.Table.FilteredRecords[i];
sum1 += (double) r.GetValue("Value1");
sum2 += (double) r.GetValue("Value2");
}
return (Math.Abs(sum1 - sum2) < 1e-7);
}