Такое всегда в DrawCell выполняется, напр.
Код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | procedure TForm1 . DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer ; Column: TColumn;
State: TGridDrawState);
const
clPaleGreen = TColor( $CCFFCC );
clPaleRed = TColor( $CCCCFF );
begin
if Column . FieldName = 'Status' then
if Column . Field . Dataset . FieldbyName( 'Status' ).AsString <> 'a' then
if (gdFocused in State) then
dbgrid1 . canvas . brush . color := clBlack
else
dbgrid1 . canvas . brush . color := clPaleGreen;
dbgrid1 . DefaultDrawColumnCell(rect, DataCol, Column, State)
end ;
|
drkb