问题详述:
dxDBGrid1 中显示一个 select语句 检索的纪录,我想让一些少数特别的纪录赋予不同于一般纪录的字体颜色来显示以突出这些少数纪录的特别! 指定特别纪录的字体颜色的代码该怎么写?:(
判断纪录中是否是符合条件的纪录的工作该怎么做? 假设:dxDBGrid1 显示表A 的纪录。 表A中有 a1(char).b1(decimal)字段。
如果纪录中b1项(decimal)>1000 ,那么这条纪录用红色字体显示,
如果纪录中b1项(decimal)>5000 ,那么这条纪录用蓝色字体显示,
就是这样。
诚心向高手们指教!!!!!!!!!!!!!!!!!!!
能解决此问题的水平一定不浅!!
dxDBGrid1 中显示一个 select语句 检索的纪录,我想让一些少数特别的纪录赋予不同于一般纪录的字体颜色来显示以突出这些少数纪录的特别! 指定特别纪录的字体颜色的代码该怎么写?:(
判断纪录中是否是符合条件的纪录的工作该怎么做? 假设:dxDBGrid1 显示表A 的纪录。 表A中有 a1(char).b1(decimal)字段。
如果纪录中b1项(decimal)>1000 ,那么这条纪录用红色字体显示,
如果纪录中b1项(decimal)>5000 ,那么这条纪录用蓝色字体显示,
就是这样。
诚心向高手们指教!!!!!!!!!!!!!!!!!!!
能解决此问题的水平一定不浅!!
解决方案 »
- delphi三层架构
- 用delete删除TList里的一个节点出问题了!
- Delphi版服设计评选[紧急]
- 关于INI文件的使用?下面的程序帮忙看看?
- 郁闷,我昨天在书店看见好几个民工模样的人在看java的书
- 关于注册表的操作!
- 如何处理扩展名为pcx的图标
- 为什么记录号不改?200分
- 怎样获取c/s结构中服务器的系统时间??
- 谁能够送我一篇完整的软件开发文档,一定重金奖励!!!!
- Web Service 组件的一个方法需要传递一个XML记录集,当这个记录集大于45K(XML数据的长度)时,上传速度突然变的很慢。。。
- 我用LOOKUPCOMBOBOXEH,已经打开了数据库,现在我想定位在一条记录上,怎么不行?
shit
procedure TForm11.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin If gdSelected In State then
begin
if Table1.Fieldbyname('C1').asstring='400002' then
begin
DBGrid1.Canvas.Brush.Color:=clred;
DBGrid1.Canvas.Font.Color:=clyellow;
end
else
begin
DBGrid1.Canvas.Brush.Color:=clyellow;
DBGrid1.Canvas.Font.Color:=clred;
end;
end
else
begin
DBGrid1.Canvas.Brush.Color:=clGradientInactiveCaption;
DBGrid1.Canvas.Font.Color:=clnavy;
end;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
if Table1.Fieldbyname('a1').asInteger> 1000 and Table1.Fieldbyname('a1').asInteger< 5000 then
dxDBGrid1.Canvas.Brush.Color:=clred
else
if Table1.Fieldbyname('a1').asInteger> 5000 then
dxDBGrid1.Canvas.Brush.Color:=clblue;
begin
dbgrid1.Canvas.Brush.Color := clRed; //定义背景颜色
end;点了按钮没反应
--------------------------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
begin
dbgrid1.Canvas.Brush.Color := clRed; //定义背景颜色
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
运行不了
[Error] Unit1.pas(41): There is no overloaded version of 'Rect' that can be called with these arguments
[Error] Unit1.pas(41): Undeclared identifier: 'State'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var ADone: Boolean);
begin
(Sender as TdxDBGrid).Canvas.Brush.Color := clRed;
dxDBGrid1.Canvas.Brush.Color := clRed;
end;依然是没反应!
兄弟知道是怎么回事吗?
procedure TForm1.DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if adoquery1.FieldByName('czy_czyxm').AsString = '2' then
DBGrid2.Canvas.Font.Color := clBlack
else
DBGrid2.Canvas.Font.Color := clRed;
DBGrid2.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
------------------------------------------------------------------------------可以TdxDBgrid组件还不行。我离成功还差一步了,兄弟们帮把手。 出了问题==>
procedure TForm1.dxDBGrid1CustomDrawCell(……);
begin
dxDBGrid1.Canvas.font.Color := clRed;
dxDBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State); /**就是这个地方
end;
编译反馈信息:
[Error] Unit1.pas(108): Undeclared identifier: 'customDefaultDrawColumnCell'
[Error] Unit1.pas(108): There is no overloaded version of 'Rect' that can be called with these arguments
[Error] Unit1.pas(108): Undeclared identifier: 'State'