打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Cxgrid单元格颜色显示
//表格单元格/行颜色变更
procedure TForm1.cxgrdbtblvw_TestSqueCustomDrawCell(
  Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
  AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
   ARec: TRect;
begin
  //单元格变化
    if (AViewInfo.GridRecord.Values[AViewInfo.Item.Index]='Pass') then
    begin
      ACanvas.Canvas.brush.Color := clGreen;
      ACanvas.FillRect(AViewInfo.Bounds);
    end;
  //行变化
  if AViewInfo.RecordViewInfo.GridRecord.Values[cxgrdbclmn_TestSque_Result.Index]='Pass' then
  begin
     ARec := AViewInfo.Bounds;
     ACanvas.canvas.brush.color:= clGreen;
     ACanvas.FillRect(ARec);
  end;
  if AViewInfo.RecordViewInfo.GridRecord.Values[cxgrdbclmn_TestSque_Result.Index]='Fail' then
  begin
    ARec := AViewInfo.Bounds;
    ACanvas.Brush.Color:= clRed;
    ACanvas.FillRect(ARec);
  end;
  if AViewInfo.RecordViewInfo.GridRecord.Values[cxgrdbclmn_TestSque_Result.Index]='Testing' then
  begin
    ARec := AViewInfo.Bounds;
    ACanvas.Brush.Color:= clOlive;
    ACanvas.FillRect(ARec);
  end;
  if AViewInfo.RecordViewInfo.GridRecord.Values[cxgrdbclmn_TestSque_Result.Index] ='' then
  begin
    ARec := AViewInfo.Bounds;
    ACanvas.Brush.Color:= clMoneyGreen;
    ACanvas.FillRect(ARec);
  end;
end;
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
delphi 改变cxgrid的行颜色
CxGrid 改变某行或单元格的颜色
cxgrid使用方法
delphi中cxGrid使用汇总(二) (转)
cxgrid动态显示行号
五年级上册 Unit 3 At the Table Lesson 1 练习卷2及答案-重大版英语.docx
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服