Discussion:
dbgrid color a row how?
(too old to reply)
bill
2007-06-11 13:31:31 UTC
Permalink
hi, i have a dbgrid which points to a table with 3 columns.the first column
is called New and its values is
No or Yes(something like new mail or no =old mail)

how can i color the specific rows where the New value=yes?(i mean where the
first column value=yes)

thks
bill
2007-06-14 23:51:26 UTC
Permalink
i have found in many websites code that is supposed to color a row in
delphi.,eg:
procedure TForm1.DBGrid1DrawColumnCell
(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if Table1.FieldByName('Salary').AsCurrency>36000 then
DBGrid1.Canvas.Font.Color:=clMaroon;
DBGrid1.DefaultDrawColumnCell
(Rect, DataCol, Column, State);
end;
i tryed to change this code to work in c++ but,it colors the entire
dbgridand not just one row,the line DBGrid1.Canvas.Font.Color:=clMaroon;
which is similar in c++ with -> instead of . doesnt color only the correct
row but allthe grid,i would appreciate any help on this matter,thank you
Post by bill
hi, i have a dbgrid which points to a table with 3 columns.the first
column is called New and its values is
No or Yes(something like new mail or no =old mail)
how can i color the specific rows where the New value=yes?(i mean where
the first column value=yes)
thks
Loading...