TForma = class(TForm)
...
private
lista : TStringList;
...
end;
procedure TForma.TuGridDblClick(Sender: TObject);
var
indice : integer;
begin
inherited;
indice := lista.add(format('%d-%d',[TuGrid.Col, TuGrid.Row]);
lista.objects := Pointer(1);
end;
procedure TForma.TuGridClick(Sender: TObject);
var
indice : integer;
begin
inherited;
indice := lista.add(format('%d-%d',[TuGrid.Col, TuGrid.Row]);
lista.objects := Pointer(0);
end;
procedure TfmCompra.fraGridxgGridDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var
texto : string;
indice : integer;
colorCelda : TColor;
begin
inherited;
texto := IntToStr(ACol)+'-'IntToStr(ARow);
indice := lista.indexOf(texto);
if indice>=0 then
begin
if Integer(lista.objects[indice])=0 then
colorCelda := clBlue
else if Integer(lista.objects[indice])=1 then
colorCelda := clRed;
end
else
colorCelda := TuGrid.color;
TuGrid.Canvas.Brush.color := colorCelda;
TuGrid.Canvas.fillRect(Rect);
end;