如何改变dbgrid中某列的各行颜色?
如:根据字段内容改变某行颜色!
如:根据字段内容改变某行颜色!
解决方案 »
- 关于提示信息显示得问题,请大家来看看!
- 请教!关于嵌入式数据库:FireBird,DBIsam,SQLite.
- 请教用IHTMLDocument2分析和遍历HTML文件内容的方法和实例
- 新手的问题:期待大侠们指导
- ——如何知道共有多少页?——
- 我按书写控件,找不到Frame3D函数,请大家帮帮我!
- 請問如何使用FloatToStrF()函數將1000.1234數值轉換為字符型'1000.1234'
- 谁能提供这样一个grid控件给我的,100分!
- 请问各位高手:客户端和服务器端为什么不能建立连接?
- 如果没人帮我,明天将被炒。
- 请问如何判断一个表是否存在
- csdn首页的论坛登录怎么让那张图片挡住了!不知你们是怎么进来的?
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
//改变某个单元格的颜色
if (uppercase(column.fieldname)='CAR_NO') then
if column.Field.asstring='黑M88147' then
with sender as Tdbgrid do
begin
canvas.Brush.color:=clblue;
canvas.Font.color:=clred;
canvas.TextRect(rect,rect.left+1,rect.top+1,'中心');
end;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
with dbgrid1 do
begin
if datasource.DataSet.FieldByName('zt').asinteger = 0 then
begin
Canvas.Brush.Color:=clRed; //背景色
Canvas.Font.Color:=clWhite; //字体色
end
else //未作废
begin
Canvas.Brush.Color:=clWhite;
Canvas.font.color := ClBlack;
end;
DefaultDrawColumnCell(rect,datacol,column,state);
end;end;