DBGRID问题,高手请进(5分)

  • 主题发起人 wangchengwu
  • 开始时间
W

wangchengwu

Unregistered / Unconfirmed
GUEST, unregistred user!
AQ_adkcjcx是一个ADOQUERY,Achievement是成绩字段,我下面这段是成绩小于60分的字体在网格中显示是红色,大于60分显示蓝色。
问题:为何我的的界面出现抖动,怎样消除?

procedure TFAcjdkcx.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
i:integer;
begin
with DBGrid1.Canvas do
begin
i:=Fdm.AQ_adkcjcx.fieldbyname('Achievement').AsInteger;
if (i<60) then
DbGrid1.Font.Color := clRed
else
DbGrid1.Font.Color := clBlue;
end;
DbGrid1.DefaultDrawColumnCell (Rect, DataCol, Column, State);
end;
 
procedure TFAcjdkcx.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
i:integer;
begin
with DBGrid1.Canvas do
begin
i:=Fdm.AQ_adkcjcx.fieldbyname('Achievement').AsInteger;
if (i<60) then
[red]Column[/red].Font.Color := clRed
else
[red]Column[/red].Font.Color := clBlue;
end;
DbGrid1.DefaultDrawColumnCell (Rect, DataCol, Column, State);
end;
 
DbGrid1.DefaultDrawColumnCell (Rect, DataCol, Column, State);
 
接受答案了.
 
顶部