Fmx TStringGrid row color

  

I have a problem in Delphi 10.1 in a multi-device application (on Windows).
I have a StringGrid (connected to a db) and I can change background color of row, but the problem is there is a “padding” (in grey/silver) between cells.

In onformCreate I define:

stringgrid1.DefaultDrawing := False;

This is my code:

procedure Tlist_form.StringGrid1DrawColumnCell(Sender: TObject;
const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF;
const Row: Integer; const Value: TValue; const State: TGridDrawStates);
var aRowColor: TBrush;
begin
aRowColor := Tbrush.Create(TBrushKind.Solid,TAlphaColors.Alpha);

if (stringgrid1.Cells[7,row]=’1′) then
aRowColor.Color := TAlphaColors.Green
else
aRowColor.Color := TAlphaColors.Red;

Canvas.FillRect(Bounds, 0, 0, [], 1, aRowColor);
Column.DefaultDrawCell(Canvas, Bounds, Row, Value, State);

aRowColor.free;

end;

In Delphi 6 I’ve never had this problem, and I don’t know how to fix-it.
Thank you.

Comments are closed.