Colored String Grid ...

HI.

1.
I use this code for changing  color od StrinGrid if row i selected.
I use Option-> goRowSelect = true, but this code work only for first row [row,0].How can I
make this code to  work for hole select row.

if (gdFocused in State) then
begin
   StringGrid1.Canvas.Brush.Color := clGreen;
   StringGrid1.Canvas.Font.Color := clGreen;
end;

2.
And how can i change color for all selected rows

Sory for my English.
Thanks
nikola_mkAsked:
Who is Participating?
 
Imthiyaz_phConnect With a Mentor Commented:
to color the whole selected row, you need to use gdSelected instread of gdFocused.
0
 
Imthiyaz_phCommented:
Instead of just setting the colors, you also need to paint them:

  if (gdSelected in State) then
  begin
    with StringGrid1.Canvas do
    begin
      Brush.Color := clGreen;
      FillRect(Rect);
    end;
  end;
0
All Courses

From novice to tech pro — start learning today.