网上文摘 小说 Flash游戏 最近更新 下载排行 资源分类 下载指南
经典编程资源 精彩不容错过
设为首页
加入收藏
联系我们
当前位置:Delphi园地技巧文章控件使用DBGrid → ...color a specific (conditional) cell in a DBGrid?
...color a specific (conditional) cell in a DBGrid?
日期:2006年11月1日 作者:Antonino Sciarrino 人气: 查看:[大字体 中字体 小字体]

//This is how to color a specific cell in a specific case.
// Define the condition for which field
// I used as Base the RX DBGRID version

procedure TFRM_Main.DBG_MainGetCellParams(Sender: TObject; Field: TField;
AFont: TFont; var Background: TColor; Highlight: Boolean);
begin

if
(Field.AsString = '0') and (Field.FullName = 'LoadingAttn') then
begin
Background := $00E69B00;
AFont.Color := clBlack;
AFont.Style := AFont.Style + [fsBold];
end
else
begin
if
(Field.AsString = '0') and (Field.FullName = 'DeliveryAttn') then
begin
Background := $0082FFFF;
AFont.Color := clBlack;
AFont.Style := AFont.Style + [fsBold];
end
else
begin
if
(Field.AsString = 'H') and (Field.FullName = 'EctaCode1') then
begin
Background := $008080FF;
AFont.Color := clBlack;
AFont.Style := AFont.Style + [fsBold];
end
else
begin
AFont.Color := clBlack;
AFont.Style := AFont.Style - [fsBold];
Background := clWhite;
end;
end;
end;


end;

(出处:DelphiFans.com)

相关文章:
·多表头的DBGridEH导出到Excel中
·DBGrid应用全书之定义表格颜色
·打印TDBGrid内容
·自制精美易用的DBGrid
·把DBGrid导出到Excel表格(支持多Sheet)
·隔行改变DBGrid网格颜色
·在Delphi的DBGrid中插入其他可视组件
·锁定DBGrid左边的列
·点击DBGrid的Title对查询结果排序
·去掉DbGrid的自动添加功能
 → 特别推荐
 → 热点TOP10
关于我们 | 广告服务 | 发布资源 | 联系站长 Copyright © 2002-2006 Delphi园地 All Rights Reserved