Hi Barry,
The TStringGrid component does not have a SelectedColor property. And since the TRzStringGrid is a direct descendant of the TStringGrid, that property is not inherited to the TRzStringGrid either because it doesn’t exist. Perhaps you were using a different grid control.
Regardless, to customize the coloring of the grid cells, you can use the OnDrawCell event handler. For example, the code below shows a very basic way to change the selection color.
Hope this helps,
Ray
procedure TForm7.FormCreate(Sender: TObject);
begin
RzStringGrid1.Cells[ 1, 1 ] := 'Delphi 10 Seattle';
RzStringGrid1.Cells[ 1, 2 ] := 'Delphi 10.1 Berlin';
RzStringGrid1.Cells[ 1, 3 ] := 'Delphi 10.2 Tokyo';
RzStringGrid1.Cells[ 1, 4 ] := 'Delphi 10.3 Rio';
end;
procedure TForm7.RzStringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
if gdSelected in State then
begin
RzStringGrid1.Canvas.Brush.Color := clGreen;
RzStringGrid1.Canvas.Font.Color := clWhite;
end
else
begin
RzStringGrid1.Canvas.Brush.Color := clWindow;
RzStringGrid1.Canvas.Font.Color := clWindowText;
end;
RzStringGrid1.Canvas.FillRect( Rect );
RzStringGrid1.Canvas.TextRect( Rect, Rect.Left + 2, Rect.Top + 2,
RzStringGrid1.Cells[ ACol, ARow ] );
end;