Hola VictoriaLerda.
No está muy claro que es lo que queres realizar... Pero como para darte una idea, te pongo un ejemplo de como podrías activar/desactivar el pintado de la fila seleccionada mediante un
TButton:
Código Delphi
[-]
...
implementation
procedure TForm1.btnOnOffClick(Sender: TObject);
begin
btnOnOff.Tag:= Integer(not Boolean(btnOnOff.Tag));
DBGrid1.Invalidate;
end;
type
TDBGridEx = class(TDBGrid);
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Boolean(btnOnOff.Tag) then
with TDBGridEx(TDBGrid(Sender)) do
if (DataLink.ActiveRecord+1 = Row)or(gdFocused in State)or(gdSelected in State) then
begin
Canvas.Brush.Color:= clMoneyGreen;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;
Saludos.