//StringGrid1 Draw Cell
procedure TForm1.StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);
var Grid: TStringGrid;
begin
Grid := Sender as TStringGrid; //THIS MUST BE HERE OR 'Read Address 0000004'
if (ARow = 0) then begin
StringGrid1.Canvas.Brush.Color := clBlue;
StringGrid1.Font.Color := clNone; // this must be here for next color statement to work
StringGrid1.Font.Color := clWhite;
StringGrid1.Canvas.FillRect(aRect);
StringGrid1.Canvas.TextOut(aRect.TopLeft.X + 2,
aRect.TopLeft.Y + 3,
StringGrid1.Cells[ACol, ARow]);
end;
StringGrid1.Cells[0, 0] := 'XXX';
end;
Two StringGrid1.Font.Color statements must be in each 'if (ARow = n)' statement.
The color will not change from the default black without placing another color statement before the second color statement.
Now the StringGrid1.Font.Color := clWhite; will work.