procedure TForm1.DBGridEh1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumnEh; State: TGridDrawState); begin if not (gdFixed in State) then begin if Column.index=1 //第一列. with DBGridEh1.Canvas do begin if DataModule1.Query1.fieldbyname('余额')>0 then Brush.Color := clred else Brush.Color:=clblue; FillRect(Rect); Font.Color:=clblack; TextOut(Rect.Left, Rect.Top, Field.AsString); end; end; end;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
begin
if not (gdFixed in State) then
begin
if Column.index=1 //第一列.
with DBGridEh1.Canvas do
begin
if DataModule1.Query1.fieldbyname('余额')>0 then
Brush.Color := clred
else
Brush.Color:=clblue;
FillRect(Rect);
Font.Color:=clblack;
TextOut(Rect.Left, Rect.Top, Field.AsString);
end;
end;
end;