代码:
procedure Tfrmproscenium.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
{with Mydata.businesstable do
begin
Connection:=Mydata.connection;
TableName:='Num_Create';
Active:=True;
end;}
if Mydata.businesstable.FieldByName('N_zhuangtai').Value='使用' then
DBGrid1.Font.Color:=clred
else
DBGrid1.Font.Color:=clGreen;
为什么我在运行窗体是,dbgrid总是在闪,什么原因呀?我该怎么解决?
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
procedure Tfrmproscenium.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
{with Mydata.businesstable do
begin
Connection:=Mydata.connection;
TableName:='Num_Create';
Active:=True;
end;}
if Mydata.businesstable.FieldByName('N_zhuangtai').Value='使用' then
DBGrid1.Font.Color:=clred
else
DBGrid1.Font.Color:=clGreen;
为什么我在运行窗体是,dbgrid总是在闪,什么原因呀?我该怎么解决?
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
DBGrid1.Canvas.Font.Color:=clred
else
DBGrid1.Canvas.Font.Color:=clGreen;
设置自动重画为False.然后用上边的代码就可以。
而飞所解决的那个是双缓冲的问题。一般情况下,不应该存在这个问题,如果存在的话,也应该是DBGrid or DBGrid.Parent的双缓冲开开。
DBGrid1.Canvas.Font.Color:=clred
else
DBGrid1.Canvas.Font.Color:=clGreen;同意 yanlls(拒绝日货(美女除外))