如何使得DBGrid1中某一个字段中的符合条件的内容为红色,不符合条件的为蓝色?在先给分... 使得DBGrid1中某一个字段中的符合条件的内容为红色,不符合条件的为蓝色?在先给分... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if Table1.FieldByName('size').AsInteger >=40 then begin DBGrid1.Canvas.Font.Color := clRed; DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end elseDBGrid1.Canvas.Font.Color := clblue; DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end;end; procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if DataCol=1 then //第一列if Table1.FieldByName('size').AsInteger >=40 then begin DBGrid1.Canvas.Font.Color := clRed; DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end elseDBGrid1.Canvas.Font.Color := clblue; DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State); end;end; 在线求救贴,DELPHI ThreadPool 里操作数据库提示 Abstract Error 但是 也执行成功了 请教 如何解决? 向所有的老鸟请教:做了那么多年的程序,你们是怎么坚持下来的? 邮件发送不完整 show与ShowModal的作用区别? fastreport中如何动态生成交叉报表?等着救命了!!!!来者有分啊!!!! 为什么Form们看不见了 通过DBgrid增加数据时,不要显示表中的原有数据? 一个简单的问题,困扰我这个新手好几天了 activeform资源释放 Delphi如何控制\使用word文档 问一个关于ADO的问题,急 一个简单问题:关于字符串的替换,在线等待回复
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Table1.FieldByName('size').AsInteger >=40 then
begin
DBGrid1.Canvas.Font.Color := clRed;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end else
DBGrid1.Canvas.Font.Color := clblue;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
end;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if DataCol=1 then //第一列
if Table1.FieldByName('size').AsInteger >=40 then
begin
DBGrid1.Canvas.Font.Color := clRed;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end else
DBGrid1.Canvas.Font.Color := clblue;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
end;