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. intellij idea 的安装与简单使用

    1.将安装包拷贝到指定目录,特别注意不要有中文路径和空格,路径不要太深 2.点击安装(如果是win10系统要使用管理员权限安装)       3. 4.修改默认安装目录:一般来说我们都不要把软件安装在 ...

  2. javascritp伪协议

    [javascritp伪协议] 将javascript代码添加到客户端的方法是把它放置在伪协议说明符javascript:后的URL中.这个特殊的协议类型声明了URL的主体是任意的javascript ...

  3. 检测到有潜在危险的 Request.Form 值——ValidateRequest的使用

    1.aspx中 在 Web 应用程序中,要阻止依赖于恶意输入字符串的黑客攻击,约束和验证用户输入是必不可少的.跨站点脚本攻击就是此类攻击的一个示例. 当请求验证检测到潜在的恶意客户端输入时,会引发此异 ...

  4. Python vars() 函数

    Python vars() 函数  Python 内置函数 描述 vars() 函数返回对象object的属性和属性值的字典对象. 语法 vars() 函数语法: vars([object]) 参数 ...

  5. Python float() 函数

    Python float() 函数  Python 内置函数 描述 float() 函数用于将整数和字符串转换成浮点数. 语法 float()方法语法: class float([x]) 参数 x - ...

  6. Windows系统之hosts文件

    对于Hosts文件相信很多Win7的系统用户会比较陌生,其实Hosts是一个没有扩展名的系统文件,可以用记事本等工具打开,其作用就是将一些常用的网址域名与其对应的IP地址建立一个关联“数据库”,所以功 ...

  7. Pocket Cube

    Pocket Cube http://acm.hdu.edu.cn/showproblem.php?pid=5983 Time Limit: 2000/1000 MS (Java/Others)    ...

  8. phpStudy1——PHP文件获取html提交的参数

    示例代码: submit.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" ...

  9. Halcon开发环境和数据结构介绍——第1讲

    1.Halcon是什么?如何初步了解Halcon? 这点我讲得不太好,不如给大家看看三个链接: ① Halcon官方网站:https://www.mvtec.com/products/halcon/ ...

  10. Scrum 项目3.0--软件工程

    1. 确保product backlog井然有序.(参考示例图1) (例图1) 2.把故事进一步拆分成任务.(参考示例图2) (例图2) 3. 形成Sprint backlog. Scrum mast ...