Hola Choclito.
Se me ocurren dos formas ahora.
Con un
TButton podrías hacer:
Código Delphi
[-]
...
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if (gdSelected in State) and FPintar then
with (Sender as TDBGrid) do
begin
Canvas.Brush.Color:= clRed;
Canvas.Font.Color:= clWhite;
DefaultDrawColumnCell(Rect, DataCol, Column, State);
MessageBeep(MB_OK); FPintar:= False;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FPintar:= True; DBGrid1.Invalidate;
end;
Con un
TCheckBox, para que quede el pintado activo según la propiedad
Checked:
Código Delphi
[-]
...
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if (gdSelected in State) and CheckBox1.Checked then
with (Sender as TDBGrid) do
begin
Canvas.Brush.Color:= clRed;
Canvas.Font.Color:= clWhite;
DefaultDrawColumnCell(Rect, DataCol, Column, State);
MessageBeep(MB_OK); end;
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
DBGrid1.Invalidate;
end;
Un saludo.
Edito: Se me olvidaba el sonido...