急求 CxGrid 的问题 ,在线等!!(等一天了,是没有人会吗?还是分给的不够!)

刘物峰 2006-10-08 05:29:01
有没有朋友知道 CxGrid 的中如何让符合条件的记录显示不同的颜色???在线等!!
如:我从数据库查出N条我想让谋谋条记录是红色!如:USER_ID=‘001’是红色!
...全文
275 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
firefox2000 2006-10-14
  • 打赏
  • 举报
回复
aiq和wqrz答对了,开帖给分说话算数
aiq 2006-10-12
  • 打赏
  • 举报
回复
cxGrid1DBTableView1 - OptionsView - GroupbyBox 设置为false
firefox2000 2006-10-12
  • 打赏
  • 举报
回复
帮你顶
顺便提一个这个控件的问题,cxGrid上方默认有一个分组拖放Panel怎么才能隐藏起来,原来的TdxDBGrid有个属性可以隐藏,但cxGrid好像没找到.

第一个回复正确的我另外开帖给100分! 请大家帮忙.
xjjrocker 2006-10-10
  • 打赏
  • 举报
回复
{设定Grid的不同行颜色显示}
procedure TfmTotalSum_NCJCSJTJ.cxGrid1DBTableView1CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
str,str1:string;
begin
str:=trim(VarAsType(AViewInfo.GridRecord.DisplayTexts[cxGrid1DBTableView1Column4.Index], varString));
str1:=trim(VarAsType(AViewInfo.GridRecord.DisplayTexts[cxGrid1DBTableView1Column10.Index], varString));
if str='不合格' then
begin
//ACanvas.Canvas.Brush.Color :=clred;
ACanvas.canvas.Font.Color :=clred;// clblack;
end
else if str='合格' then
begin
//ACanvas.Canvas.Brush.Color :=clgreen;
ACanvas.canvas.Font.Color :=clgreen;// clblack;
end;
if AViewInfo.Selected then
begin
ACanvas.Canvas.Font.Color :=clwhite; //clBlue ;字体颜色
ACanvas.Canvas.Brush.Color :=clNavy ;//clwhite;背景颜色
end;
if str1='已上传'then
begin
ACanvas.Canvas.Brush.Color :=clGradientActiveCaption ;
end;

end;
Ass_Of_Gril 2006-10-10
  • 打赏
  • 举报
回复
procedure TFramePayCards.cxGrid1DBTableView1CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
Value :Tdate;
begin
inherited;

if AViewInfo.GridRecord.DisplayTexts[
cxGridDBColumn11.Index] = '' then Exit;

Value := VarAsType(AViewInfo.GridRecord.Values[
cxGridDBColumn11.Index], varDate);
if FormatDateTime('yyyyMMdd', Value) < FormatDateTime('yyyyMMdd', Date) then
ACanvas.Font.Color := clRed;
end;
chenyansong 2006-10-08
  • 打赏
  • 举报
回复
如何使满足条件的数据显示不同的颜色?
解决:
var
AYellowStyle: TcxStyle;

procedure TForm1.FormCreate(Sender: TObject);
begin
//行颜色
AYellowStyle := TcxStyle.Create(Self);
AYellowStyle.Color := $0080FFFF;
AYellowStyle.TextColor := clMaroon;
end;

procedure TForm1.cxGrid1DBBandedTableView1StylesGetContentStyle(
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
begin
if ARecord.Values[cxGrid1DBBandedTableView1Lengthcm.Index] < 81 then
AStyle := AYellowStyle;
end;

这里cxGrid1DBBandedTableView1Lengthcm.Index小于81时就显示黄色
dashi 2006-10-08
  • 打赏
  • 举报
回复
接分~谢谢~~~

829

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧