DBgrid1.Canvas.Font.Color:=clBlack; I := 0 ; DBGrid1.Canvas.Brush.Color := clInfoBk ; if ( DBGrid1.DataSource.DataSet.FieldByName('OPERATIONDATE').value <> null ) then I := (( CFSDM.MY_NOW - DBGrid1.DataSource.DataSet.FieldByName('OPERATIONDATE').ASDATETIME ) * 1440) ; if I > 15 then DBGrid1.Canvas.Brush.Color := clLime ; if I > 30 then DBGrid1.Canvas.Brush.Color := clYellow; if I > 45 then DBGrid1.Canvas.Brush.Color := clRed ;不同时间,行显示不同颜色。
+ ' where qdsj between '
+ QuotedStr(FormatDateTime('yyyy-mm-dd', sp1.Date))
+ ' and ' + QuotedStr(formatdatetime('yyyy-mm-dd', sp2.Date));注意空格
I := 0 ;
DBGrid1.Canvas.Brush.Color := clInfoBk ;
if ( DBGrid1.DataSource.DataSet.FieldByName('OPERATIONDATE').value <> null )
then I := (( CFSDM.MY_NOW - DBGrid1.DataSource.DataSet.FieldByName('OPERATIONDATE').ASDATETIME ) * 1440) ;
if I > 15 then
DBGrid1.Canvas.Brush.Color := clLime ;
if I > 30 then
DBGrid1.Canvas.Brush.Color := clYellow;
if I > 45 then
DBGrid1.Canvas.Brush.Color := clRed ;不同时间,行显示不同颜色。