delphifiremonkeydelphi-xe7tgridfiremonkey-style

How to change the colour of the stringgrid particular cell using Delphi XE7


I'm using Delphi XE7 for developing Android application. In that I have used TStringGrid component and then I have used StringGrid.cells[0, 0] := 'Test' And how can I change the Font colour of that particular cell which I have shown in the code. And also I have this sample code, but I can not change the font colour of the particular cell. Please anybody explain me how to change the font colour of the particular cell value. And I'm using Delphi XE7 and I'm targeting Android mobile.

Thanks..


Solution

  • At last, I have found the solution which I required. Please follow the Steps. We can able to change the font color in TStringGrid itself, No need to use TGrid. Please follow the below steps.

    First assign this in FormCreate event:

      StringGrid1.DefaultDrawing := False;
    

    then write this in StringGrid DrawColumnCell event:

      Canvas.fill.Color := TAlphaColorRec.Green;
      Canvas.FillText(Bounds, (Value.AsString),
        false, 100, [], TTextAlign.taLeading, TTextAlign.taCenter);