procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect:TRect;DataCol: Integer; Column: TColumn; State: TGridDrawState);begin
if Table1.FieldByName('Population').AsInteger > 20000000 then
DBGrid1.Canvas.Font.Color := clBlue; DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end
if Table1.FieldByName('Population').AsInteger > 20000000 then
DBGrid1.Canvas.Font.Color := clBlue; DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end
解决方案 »
- 数据库开发 应该向导创建还是用create代码创建,优势在哪里
- delphi 应用层 调试问题
- 关于DevExpresss的cxProperties使用
- 请诸位帮我解释一段DELPHI连接SQL SERVER的代码
- *** 高分提问,请问RichEdit的内容如何导出成Html文件?***
- Delphi7中怎样时QUICK REPORT 可用?
- 急!急!如何在打印时动态的改变纸张的大小!诚请各位指定迷津!谢
- 用代码如何实现出现AdoConnection设置ConnectionString时出现的属性窗口?
- 我也豁出去了,花50分提问
- 关于ado中存储过程构件ADOStoredProc中的参数问题,真是奇怪!!!!
- 请问DELPHI中怎么提取EXE文件的参数,请高手赐教!
- 关于汉字的简单问题。--急急急!!!!
if Table1.FieldByName('Size').AsFloat > 10 then
DBGrid1.Canvas.Font.Color := clRed;
DBGrid1.DefaultDrawDataCell(Rect, Field, State);
end;
然后在DBBrid的DrawColumnCell事件中这样做:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Column.Field.AsInteger < 75 then begin
DBGrid1.Canvas.Font.Color := clWhite;
DBGrid1.Canvas.Brush.Color := clRed; //这里设置单元格填充色
DBGrid1.Canvas.FillRect(Rect); //这里对相应的单元格进行北景色填充
end;
//输出内容
DBGrid1.Canvas.TextRect( Rect, Rect.Left, Rect.Top, Column.Field.AsString);
end;