定义一个类:

TMyCxGrid = class(TObject)
class procedure DrawIndicatorCell( Sender: TcxGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
end; class procedure TMyCxGrid.DrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
var
FValue: string;
FBounds: TRect;
//method
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, -, -); Sender.LookAndFeelPainter.DrawHeader(ACanvas, AViewInfo.Bounds,
ATextRect, [], cxBordersAll, cxbsNormal, taCenter, TcxAlignmentVert.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, -, -); 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, TcxAlignmentVert.vaCenter,
False, False, IntToStr(AIndicatorViewInfo.GridRecord.Index + ),
AFont, AFontTextColor, AColor);
ADone := True; end;

然后调用即可:

tvList.OptionsView.Indicator:=True;
tvList.OptionsView.IndicatorWidth:=;
tvList.OnCustomDrawIndicatorCell:= TMyCxGrid.DrawIndicatorCell;

测试GridMode显示有问题。

cxGrid显示行号的更多相关文章

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

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

  2. vc6.0如何显示行号以及出现版本不兼容问题

    有时编译时,提示某某行有错,但是要定位到某一行的话,如果在编辑页面能够将行号显示出来,查找也就更方便了,下面我来介绍一下让VC6.0显示行号的方法.   工具/原料   VC6.0.显示行号的插件 方 ...

  3. Row_Number()显示行号

    SELECT *, Row_Number() OVER (partition by deptid ORDER BY salary desc) rank FROM employee Row_Number ...

  4. vim显示行号、语法高亮、自动缩进的设置

    转载自:http://blog.csdn.net/chuanj1985/article/details/6873830   在UBUNTU中vim的配置文件存放在/etc/vim目录中,配置文件名为v ...

  5. mac/linux中vim永久显示行号、开启语法高亮

    步骤1: cp /usr/share/vim/vimrc ~/.vimrc 先复制一份vim配置模板到个人目录下 注:redhat 改成 cp /etc/vimrc ~/.vimrc 步骤2: vi ...

  6. 如何让vim编辑器永久显示行号

    在Linux环境下的编辑器有vi.vim.gedit等等.进入这些编辑器之后,为了方便我们需要编辑器显示出当前的行号,可偏偏编辑器默认是不会显示行号的.我们有二种办法可以解决: 第一种是,手动显示:在 ...

  7. PyCharm 教程(四)显示行号

    PyCharm 教程(四)显示行号 在PyCharm 里,显示行号有两种办法: 1,临时设置.右键单击行号处,选择 Show Line Numbers. 但是这种方法,只对一个文件有效,并且,重启Py ...

  8. DEV控件Grid显示行号

    DEV控件Grid的显示行号需要通过一个事件来设置,具体设置代码为: private void gridView1_CustomDrawRowIndicator(object sender, DevE ...

  9. vs2013显示行号

    随便打开一个项目,可以看到代码框内并没有显示行号 选择“工具”-“选项”,打开后界面如下 选择文本编辑器,找到下图中的“行号”并勾选 行号可以显示了 5 这样我们就完成了任务

随机推荐

  1. Mac下在Intellij Idea里设置VM运行参数的正确方法

    打开应用程序,右键选择显示包内容 可以看到idea的初始jvm配置的位置: 但是真正生效的配置是个人目录下的此文件,注意每个版本都会重新生成一次 设置idea使其在右下角的位置显示内存使用情况:483 ...

  2. POJ 1270 Following Orders

    Following Orders Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4902   Accepted: 1982 ...

  3. 【BZOJ】【1941】【SDOI2010】Hide and Seek

    KD-Tree 一开始看错题了

  4. 数学图形之将曲线(curve)转化成曲面管

    在我关于数学图形的博客中,一开始讲曲线的生成算法.然后在最近的章节中介绍了圆环,还介绍了螺旋管以及海螺的生成算法.一类是曲线,一类是环面,为什么不将曲线变成环的图形,毕竟曲线看上去太单薄了,这一节我将 ...

  5. Search for a Range leetcode java

    题目: Given a sorted array of integers, find the starting and ending position of a given target value. ...

  6. jquery选择器用法笔记(第一部分)

    由于我在项目中用jquery比较多,而且觉得jquery真的很不错,尤其是其灵活高效的选择器更是令人无法忘怀.那么,今天就来写一篇非常基础的关于jquery选择器的文章,路过的朋友可以收藏以作参考. ...

  7. 思维导图软件xmind和mindmanager哪个更好

    思维导图是一种将放射性思考具体化的方法,可以将人们的创造性思维及时捕捉并呈现,目前便捷的网络为人们带来了众多的思维导图软件,而在这些软件中只有亲身实践体验过,才能知道到底思维导图哪个好,哪个又适合自己 ...

  8. nyoj-659-推断三角形(大坑)

    推断三角形 时间限制:1000 ms  |  内存限制:65535 KB 难度: 描写叙述 小明非常喜欢研究三角形.如今,小明已经知道三角形的三条边.假设三条边能组成三角形,小明就会非常高兴,他就会得 ...

  9. 【nodejs】修改了下对股票表进行crud操作的代码

    表是这样的: id是自增长字段,code和name都是255位的varchar. 下面是主角app.js的代码: 'use strict'; var express=require('express' ...

  10. No configuration found for the specified action解决办法(转)

    使用Struts2,配置一切正常,使用常用tag也正常,但是在使用<s:form>标记时,发现控制台总是输出警告信息, 警告信息内容如下: 警告: No configuration fou ...