uses cxLookAndFeelPainters;

type

TMyCxGrid = class(TObject)
    class procedure DrawIndicatorCell(
      Sender: TcxGridTableView; ACanvas: TcxCanvas;
      AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
  end;

{ TMyCxGrid }

class procedure TMyCxGrid.DrawIndicatorCell(Sender: TcxGridTableView;
  ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo;
  var ADone: Boolean);
var
  AIndicatorViewInfo: TcxGridIndicatorRowItemViewInfo;
  ATextRect: TRect;
  AFont: TFont;
  AFontTextColor, AColor: TColor;
begin
  AFont := ACanvas.Font;
  AColor := clBtnFace;
  AFontTextColor := clWindowText;
  if (AViewInfo is TcxGridIndicatorHeaderItemViewInfo) then
  begin
    ATextRect := AViewInfo.Bounds;
    InflateRect(ATextRect, -1, -1);

Sender.LookAndFeelPainter.DrawHeader(ACanvas, AViewInfo.Bounds,
      ATextRect, [], cxBordersAll, cxbsNormal, taCenter, vaCenter,
      False, False, 'NO',AFont, AFontTextColor, AColor);
    ADone := True;
  end;
  if not (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
    Exit;
  ATextRect := AViewInfo.ContentBounds;
  AIndicatorViewInfo := AViewInfo as TcxGridIndicatorRowItemViewInfo;
  InflateRect(ATextRect, -1, -1);

if AIndicatorViewInfo.GridRecord.Selected then
    AFont.Style := ACanvas.Font.Style + [fsBold]
  else
    AFont.Style := ACanvas.Font.Style - [fsBold];

Sender.LookAndFeelPainter.DrawHeader(ACanvas, AViewInfo.ContentBounds,
    ATextRect, [], [bBottom, bLeft, bRight], cxbsNormal, taCenter, vaCenter,
    False, False, IntToStr(AIndicatorViewInfo.GridRecord.Index + 1),
    AFont, AFontTextColor, AColor);
  ADone := True;
//  ASender.LookAndFeelPainter.DrawIndicatorImage(ACanvas, ATextRect,
//    AIndicatorViewInfo.IndicatorKind);

end;

procedure ShowLineNo(c: TcxGridDBTableView);
begin
  c.OptionsView.Indicator := True;
  c.OptionsView.IndicatorWidth := 40;
  c.OnCustomDrawIndicatorCell := TMyCxGrid.DrawIndicatorCell;
end;

 
 
 
好文要顶 关注我 收藏该文 

cxgrid动态显示行号的更多相关文章

  1. cxGrid 显示行号及行号列列名

    cxGrid默认不显示行号,但是可以通过cxGrid1DBTableView1CustomDrawIndicatorCell事件来重绘行号 选中cxGrid1DBTableView1,在OnCusto ...

  2. cxGrid显示行号

    定义一个类: TMyCxGrid = class(TObject) class procedure DrawIndicatorCell( Sender: TcxGridTableView; ACanv ...

  3. 让cxGrid像Excel那样高亮显示选区的行号列标

    http://www.oschina.net/code/snippet_54100_1102 Developer Express的cxGrid控件是一个相当有特色的数据栅格组件,支持自动分组.卡片式显 ...

  4. linux vim 插入行号

    1 在文本中插入行号 最近有朋友提到某编辑器有一个可以插入行号的插件,问Vim有没有办法可以在文章中插入行号.%$^&*#8~#$@#!--让我们看一下有多少种方式可以在vim中插入行号或数字 ...

  5. vim 加行号 和取消行号

    :set nu #是加行号 :set nonu #是去掉行号

  6. databtables 设置(显示)行号

    var table = $('#priceStrategtyTable').DataTable({         "rowCallback": function( row, da ...

  7. EasyUI datagrid : 启用行号、固定列及多级表头后,头部行号位置单元格错位的问题

    症状如图: 上图中,行号列与checkbox 列融合了.解决方法是在datagrid 的 onLoadSuccess 事件中加入如下代码: var opts = $(this).datagrid('o ...

  8. Android studio 显示代码行号 设置

    首先我们打开我们的Android Studio.   这时会弹出setting页面,我们选择show line numbers然后点击确定按钮.   此时我们就可以看到代码左侧显示出行号了   我们可 ...

  9. gedit 没有preference项,使preference回归,并用命令行设置行号,text wrapping等

    1.最简单的,使preference选项回来: gsettings set org.gnome.settings-daemon.plugins.xsettings overrides '@a{sv} ...

随机推荐

  1. ORACLE用户永不被锁

    alter profile default limit FAILED_LOGIN_ATTEMPTS UNLIMITED;

  2. jquery读取本地文件,Windows上报错。XMLHttpRequest cannot load xxx. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.k.cors.a.c

    问题: 测试报告,使用本地的json.txt文件,结果文件读取失败,报错如下: XMLHttpRequest cannot load xxx. Cross origin requests are on ...

  3. java基础四 [构造器和垃圾回收](阅读Head First Java记录)

    本章讲解了对象的创建到被回收的过程,讲述了对象的生命周期   堆(heap)与栈(stack) 实例变量:实例变量是只声明在类下,方法外的变量(实例变量默认值为0/0.0/false,引用的默认值为n ...

  4. JS中如何处理多个ajax并发请求?

    js中的多并发处理. 通常 为了减少页面加载时间,先把核心内容显示处理,页面加载完成后再发送ajax请求获取其他数据 这时就可能产生多个ajax请求,为了用户体验,最好是发送并行请求,这就产生了并发问 ...

  5. ubuntu下安装.deb包的安装方法

    ubuntu16.04的软件中心应该是有bug,安装不了第三方.deb文件,我们只有使用dpkg -i 或者gdebi的方式安装,我使用的是后者,因为后者功能更加强大.要使用gdebi命令先要安装它: ...

  6. 【校招面试 之 C/C++】第11题 C++ 纯虚函数

    1.纯虚函数 成员函数的形参后面写上=0,则成员函数为纯虚函数. 纯虚函数声明: virtual 函数类型 函数名 (参数表列) = 0: class Person { virtual void Di ...

  7. win下安装composer

    1.在官网上下载composer的安装程序. https://getcomposer.org/ 2.双击运行Composer-Setup.exe程序,选择你自已的php安装目录打到php.exe.   ...

  8. dddddddddddddddddd

    PacificA: Replication in log-based distributed storage systemshttp://research.microsoft.com:8082/pub ...

  9. mysql简单实现查询结果添加序列号的方法

    方法1: SELECT @rownum :=@rownum + 1 AS rownum, t.* FROM integral_system_user t, (SELECT @rownum := 0) ...

  10. Telnet 安装

    Telnet 安装 一.Telnet 安装 (1) 登录目标主机检测 telnet 服务是否正常 [root@localhost ~]# telnet localhost -bash: telnet: ...