...change the default cell selection color in a TStringGrid?
Author: Thomas Stutz
// Man muss im OnDrawCell die selektierte Zelle selber zeichnen.
// You have to handle the OnDrawCell event and draw the selected cell yourself.
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;
printed from
www.swissdelphicenter.ch
developers knowledge base