看这段小例子,很容易明白。
procedure TfmConsole.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if dmUnit4.cdsq_TPop3InfofOwnerStr.AsString='0' then
DBGrid1.Canvas.Font.Color:=clGray;
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
{判断是否为系统基本账号,否则颜色变灰}
end;