Selected Row of a TDBGrid?
Use the OnPrepareCanvas event and try this code:
procedure TForm1.DBGrid1PrepareCanvas(sender: TObject; DataCol: Integer;
Column: TColumn; AState: TGridDrawState);
begin
if ([gdSelected, gdFocused] * AState <> []) then begin
if (DBGrid1.SelectedColumn = Column) then begin
DBGrid1.Canvas.Brush.Color := clRed;
DBGrid1.Canvas.Font.Color := clWhite;
end else
begin
DBGrid1.Canvas.Brush.Color := RgbToColor(255, 128, 128);
DBGrid1.Canvas.Font.Color := clBlack;
end;
end;
end;
This is for row-select mode, but you certainly can adapt it to normal single-cell mode easily.