Mega Code Archive

 
Categories / Delphi / Graphic
 

How to change the default cell selection color in a TStringGrid

Title: How to change the default cell selection color in a TStringGrid procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); const SelectedColor = Clblue; begin if (state = [gdSelected]) then with TStringGrid(Sender), Canvas do begin Brush.Color := SelectedColor; FillRect(Rect); TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Cells[aCol, aRow]); end; end;