2

I want to change the background color of an entire row based on calculations made.

The problem I am facing in either the CustomAppearance or the CustomDrawCell events is that it iterates through every cell and does the calculation. I want to basically change the row color on column index 0, thus not having to loop through the big data set:

    private void pvtGrdCtrlSummaryGrid_CustomDrawCell(object sender, PivotCustomDrawCellEventArgs e)
    {                
            if (e.RowValueType == PivotGridValueType.Value && e.ColumnValueType == PivotGridValueType.GrandTotal && e.ColumnIndex == 0)
            {
              //Calculations made
              //Change the entire row color here
            }
     }

So I can change each individual cell and it works as expected, but when scrolling it is extremely slow and does not scroll smoothly at all.

I am using a pivotgridcontrol in a C# WinForms app.

1 Answers1

1

Perform calculations in the moment when you filling a dataset and not in CustomDrawCell. If you can not, so try to limit the calculation only one column. for example :

if (e.Column.Name == bgcDIRECTION.Name)

Or add auxiliary column that will be default null and consecrate him in CustomDrawCell ... only if it is null. If it has not null, then contains the calculated value yet.

Majkl
  • 765
  • 1
  • 9
  • 25