如何改变DBGridEh中其中某个单元格的字体颜色

procedure TFormMain.DbgAllDrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumnEh;
  State: TGridDrawState);
begin
  if (Column.FieldName='1|规格') and
     (DbgAll.DataSource.DataSet.FieldByName('1|规格').AsString='关机') then
      DbgAll.Canvas.Font.color:=clred;
      DbgAll.DefaultDrawColumnCell (Rect, DataCol, Column, State);
  end;
end;

猜你喜欢

转载自blog.csdn.net/qq_34550571/article/details/83548898