Hello. There are 2 grids. 2 values ​​are compared, and if the values ​​of the 1st are greater, then the comparison string is green, the other is red in the 2nd grid. Passed the cycle (the number of lines is fixed), but the previously painted lines become transparent by default. That is, only the focused row is colored, HideSelectionRow does not work. How to be ???


I use With #. It was possible to tint the rows through the RowStyles event (having previously added a field to the database, dynamically the values ​​are written during the execution of the program and the colors are recorded for these values), but a new problem arose, the focused (not selected) row is not colored.

    1 answer 1

    Hello. Check which revision you are using (VCL, ASP ...). For VCL, you can use the following option:

    OnCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean); var val1, val2 : Variant; begin if AViewInfo.Selected then exit; val1 := VarAsType(AViewInfo.GridRecord.DisplayTexts[Col1.Index], varInteger); val2 := VarAsType(AViewInfo.GridRecord.DisplayTexts[Col2.Index], varInteger); if (val1 > val2) then begin ACanvas.Canvas.Font.Color := clWindowText; ACanvas.Canvas.Brush.Style := bsSolid; ACanvas.Canvas.Brush.Color := clYellow; end; end; 

    Or you can use AViewInfo.GridRecord.Values ​​instead of DisplayTexts. As a result, if the value of val1> val2, the entire line will be highlighted in yellow.