现在的位置: 首页 > 综合 > 正文

在DELPHI中的DBGrid控件实现条件格式

2013年08月31日 ⁄ 综合 ⁄ 共 383字 ⁄ 字号 评论关闭
procedure TfmInfo.dgInfoDrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if ADODataSet1.FieldByName('库存').AsInteger = 0 then
  begin
    with dgInfo do
    begin
      Canvas.Brush.Color:=clYellow; //设置背景色
      Canvas.Font.Color:=clRed; //设置字体颜色
      Canvas.fillrect(Rect);
      DefaultDrawColumnCell(Rect,DataCol,Column,State);
    end;
  end;
end;  

抱歉!评论已关闭.