Jump to content


How to set/change row color?


  • Please log in to reply
1 reply to this topic

#1 altt

altt
  • Members
  • 17 posts

Posted 27 June 2012 - 03:17 PM

Hi,
i want something like:
for i := 0 to grid.RowCount - 1 do
begin
  if SomeBoolVar then
	grid.Row[i].Color := ...
end

?

#2 deonvn

deonvn

    Senior Member

  • Honorable Members
  • PipPip
  • 303 posts

Posted 27 June 2012 - 04:15 PM

Hi altt

You can use the grid's OnCellColoring event to control the color of individual cells or rows.

procedure TForm1.NextGrid1CellColoring(Sender: TObject; ACol, ARow: Integer;
  var CellColor, GridColor: TColor; CellState: TCellState);
begin
  if NextGrid1.Cell[0,ARow].AsBoolean = True then
	CellColor := clRed;
end;

Hope that helps :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users