Hola a todos.
Después de mucho probar y leer en la ayuda y ver las posibles funciones y procedimientos en muchos componentes de Delphi y, sobre todo, de dedicarle mucho tiempo esta semana, por fin
he conseguido mi propósito.
Para ello, he utilizado el mismo evento que usaba en Windows, como decía Agustín, y como no podía ser de otro modo, es decir: el evento
OnDraw del TStringGrid.
Por si le sirve a algún novato como yo, copio el código del evento a continuación, modificado desde el original de VCL (Windows), que ya he publicado más arriba, para FireMonkey. De forma que si alguien se encuentra con el mismo problema no tenga que perder tanto tiempo como yo.
Código Delphi
[-]
procedure TPrinci.grdTableroDrawColumnCell(Sender: TObject;
const Canvas: TCanvas; const Column: TColumn; const [Ref] Bounds: TRectF;
const Row: Integer; const [Ref] Value: TValue; const State: TGridDrawStates);
var Tablero : TTablero;
R : TRectF;
S : String;
begin Cuantos:=Cuantos+1;
R:=Bounds;
StringGridToTablero(Tablero);
ColTableroActual:=Column.Index;
RowTableroActual:=Row;
with grdTablero, grdTablero.Canvas do
begin
R.Width := Bounds.Width - 1;
R.Height :=Bounds.Height-2;
R.Left := R.Left + 2;
R.Top := R.Top + 1;
if (ColAct = Column.Index) and (FilAct=Row) then
begin
ClearRect(R, claGreenyellow);
end
else begin
if Odd((Column.Index div 3) + (Row div 3))
then ClearRect(R, claLightgrey)
else ClearRect(R, claLavender);
end;
if TableroGenerado[Column.Index, Row] > 0 then
TextSettings.FontColor:=claRed
else begin
if (TableroAyudado[Column.Index, Row]=1) and
(Tablero[Column.Index, Row]=TableroResuelto[Column.Index,Row]) then TextSettings.FontColor:= claBlue
else TextSettings.FontColor:= claBlack;
end;
Canvas.Fill.Color:=TextSettings.FontColor;
Canvas.Font.SetSettings('Arial',22,grdTablero.TextSettings.Font.Style);
S := grdTablero.Cells[Column.Index, Row];
Canvas.FillText(R,S,False,1,[TFillTextFlag.ftRightToLeft],TTextAlign.taCenter, TTextAlign.taCenter);
end; end;
Saludos a todos.