dbGrid中的字体颜色能否控制? dbGrid->dataSource->Query通过Query语句从数据表中查出的数据,能否使用一个越界判断语句,使得超出界限的数字以红色显示? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 if query1.FieldByName('car_no').Asstring > 'a' then begin DBGrid1.Canvas.Font.Color := clRed;//字体色 DBGrid1.Canvas.Brush.Color := clBlue;//背景色 DBGrid1.Canvas.FillRect(Rect); 在这个里面写procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);beginif Column.Title.Caption='SIZE' then if Column.Field.Value > 5 then begin DBGrid1.Canvas.Font.Color := clRed;//字体色 DBGrid1.Canvas.TextRect(Rect, Rect.Left, Rect.Top + 2,Column.Field.AsString); end;end; procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);begin if NeedRed then DBGrid1.Canvas.Font.Color:=clRed; DBGrid1.DefaultDrawColumnCell(Rect, DataCol,Column, State);end; 一个简单的Windows窗体功能 各位大哥大姐些,小妹请教个关于clientdataset的问题 各位大虾!帮忙啊,小弟毕业设计难题,急啊!,在线等! 关于webbrowser的问题 为什么DELPHI的关于中都有一个 豪华宫殿?到底代表什么历史意义? 请帮忙 如何动态配置ODBC,使之连接到本地数据文件? 怎样在delphi的treeview中添加没有重复的节点,并同时保存到数据库中. 奇怪,700变7,谢谢帮帮忙 怎模控制TDBEdit输入的是数字?急!! 窗口类 谁有Dephi 7 de Free eToys和Updates
DBGrid1.Canvas.Font.Color := clRed;//字体色
DBGrid1.Canvas.Brush.Color := clBlue;//背景色
DBGrid1.Canvas.FillRect(Rect);
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Column.Title.Caption='SIZE' then
if Column.Field.Value > 5 then
begin
DBGrid1.Canvas.Font.Color := clRed;//字体色
DBGrid1.Canvas.TextRect(Rect, Rect.Left, Rect.Top
+ 2,Column.Field.AsString);
end;
end;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if NeedRed then
DBGrid1.Canvas.Font.Color:=clRed;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol,Column, State);end;