For example, Column 2 can contain two different values (Yes, No). What I want to do is alter the code below to change the TextColor of the cells in Column 1 & Column 2 both based upon the value in Column 2. What needs to change in the code below to make this possible?
Here is the code I am using to change the font color of a cell based upon it's value.
procedure TForm1.NextDBGrid1CellFormating(Sender: TObject; ACol, ARow: Integer; Value: WideString; var TextColor: TColor; var FontStyle: TFontStyles; CellState: TCellState); begin if (ACol = 2) then if value = 'No' then begin TextColor := clRed; end; end;
Please note, The above question may imply that I want to just change the font color for all the cells in a row and this is not what I want to do. All I want to do is change the font color of the cells in columns 1 & 2 ONLY, Any other cells in the row should not be affected by this code.