Dbgrid的DrawColumnCell事件中加入以下代码就可以了:
If Query.fieldbyname('字段名').values 满足条件 then
Begin
Dbgrid.Canvas.Brush.Color := 颜色(如:clInfoBk) ;
Dbgrid.DefaultDrawColumnCell( Rect, DataCol, Column,[gdFixed,gdFocused,gdSelected] );
End ; 类似的这样代码好像不能实现 都是直接改变颜色的 而不是通过点击之后才改变的 请高手看看
If Query.fieldbyname('字段名').values 满足条件 then
Begin
Dbgrid.Canvas.Brush.Color := 颜色(如:clInfoBk) ;
Dbgrid.DefaultDrawColumnCell( Rect, DataCol, Column,[gdFixed,gdFocused,gdSelected] );
End ; 类似的这样代码好像不能实现 都是直接改变颜色的 而不是通过点击之后才改变的 请高手看看
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货