首页 > 其他分享 >cxgrid显示行号

cxgrid显示行号

时间:2023-05-06 15:48:48浏览次数:34  
标签:显示 AViewInfo Color cxgrid Style ATextRect 行号 acv Font

把cxGridView里OptionsView选项中的两项修改成如下

OptionsView.Indicator = True
OptionsView.IndicatorWidth = 40//宽度

在customDrawIndicatorCell事件中填写

procedure TForm1.cxGrid1BandedTableView1CustomDrawIndicatorCell(
Sender: TcxGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
var
AIndicatorViewInfo: TcxGridIndicatorRowItemViewInfo;
ATextRect: TRect;
// AStyle: TcxStyle;
aCV:TcxCanvas;
begin
if not (AViewInfo is TcxGridIndicatorRowItemViewInfo) then
Exit;
aCV:=ACanvas ;
ATextRect := AViewInfo.ContentBounds;
AIndicatorViewInfo := AViewInfo as TcxGridIndicatorRowItemViewInfo;
InflateRect(ATextRect, -2, -1);

if AIndicatorViewInfo.GridRecord.Selected then //这个if段是为了在行号处把把选中的行号跟别的区分开,可不用
begin
aCV.Font.Style := Canvas.Font.Style + [fsBold];
aCV.Font.Color := clRed;
end
else
begin
aCV.Font.Style := Canvas.Font.Style - [fsBold];
acv.Font.Color := Canvas.Font.Color;
end;

Sender.LookAndFeelPainter.DrawHeader(ACanvas, AViewInfo.ContentBounds,
ATextRect, [], cxBordersAll, cxbsNormal, taCenter, vaCenter,
False, False, IntToStr(AIndicatorViewInfo.GridRecord.Index + 1),
// AStyle.Font, AStyle.TextColor, AStyle.Color);
acv.Font,acv.font.Color,acv.Brush.color );
ADone := True;
end;

标签:显示,AViewInfo,Color,cxgrid,Style,ATextRect,行号,acv,Font
From: https://www.cnblogs.com/lucken2000/p/17377553.html

相关文章

  • ls 每行只显示一个文件名
    ##这是数字1,不是字母lls-1##NF表示总列数,因此${NF}表示最后一列##因为只有1列,所以$0和${NF}等同ls|awk'{print$0}'ls|awk'{print${NF}}'##ls-l则有9列ls-l|awk'{print$9}'【转】ls每行只显示一个文件名|Fang(fqk.io)......
  • 在Winform分页控件中集成保存用户列表显示字段及宽度调整设置
    在Winform的分页控件里面,我们提供了很多丰富的功能,如常规分页,中文转义、导出Excel、导出PDF等,基于DevExpress的样式的分页控件,我们在其上面做了不少封装,以便更好的使用,其中就包括集成保存用户列表显示字段及宽度调整设置。本篇随笔介绍这个实现的过程,通过在当前程序中序列化方式存......
  • Windows11 无法显示卓越性能以及仅有平衡模式一条计划的解决方案
    如果你用的是专业工作站版,且使用了如下命令:Powercfg/DUPLICATESCHEMEe9a42b02-d5df-448d-aa00-03f14749eb61还是无法显示任何多余计划,那么就证明你用的系统版本已经实施了新式待机:ModernStandbyonWindows该模式只可以通过设置-电池电源中设置最佳性能,而无法在控制面板......
  • CSS实现单行、多行文本溢出显示省略号
    代码单行文字溢出打点div{width:100px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}多行文字溢出打点div{width:100px;overflow:hidden;text-overflow:ellipsis;......
  • WPF主窗口显示
    我需要完成这样的一个功能,程序在运行期间时刻检测一个值的变化,当这个值变化后,立即将主窗口进行运行,用户可以进行操作。目前做的demo是这样的,来证明这个方法的可行性。我写了一个主窗口,当这个窗口最小化五秒后,又在屏幕上可见。publicpartialclassMainWindow:Window{......
  • 如何不显示我的电脑、回收站等图标?
      本文介绍将Windows电脑中的Administrator、网络、回收站等系统自带桌面图标取消显示或恢复显示的方法。  在Windows10电脑中,一般在桌面上默认会显示如下所示的一些系统自带图标。  然而,在上述这些图标中,有一些我们可能相对而言使用的频率比较低,比如网络图标,以及上图中......
  • 一个stm23移植u8g2驱动iic屏SSD1306方案12864的左边竖着两列没有显示的奇怪问题
    初始化后画一个方框u8g2_DrawLine(&u8g2,0,0,127,0);u8g2_DrawLine(&u8g2,1,0,1,63);//左边框u8g2_DrawLine(&u8g2,0,63,127,63);u8g2_DrawLine(&u8g2,127,0,127,63);左边框地址为0不显示,设置为1还是不显示设置为2可以看到竖线了中景园......
  • obsidian 日记本倒序汇总 获取标题显示 插件dataviewjs list
    obsidian日记本倒序汇总获取标题显示插件dataviewjslist//dataviewjsfunctionremoveDuplicate(arr){returnarr.filter((item,index)=>{returnarr.indexOf(item)===index})}constlist=dv.pages('"02日记本"').file.lists.map(item=>{ retu......
  • 【快应用】组件如何页面底部显示
    【关键词】底部、postion 【问题背景】快应用中某个组件如果要实现在页面底部展示,该如何实现呢? 【实现方法】可以通过设置postion为fixed,再设置margin-top属性和bottom属性来将组件在页面底部显示。方法一:设置postion为fixed,bottom为0px<template><divclass="cont......
  • 指定Activity的默认显示方向
    在Manifest文件中指定 screenOrientation android:screenOrientationTheorientationoftheactivity'sdisplayonthedevice.Thesystemignoresthisattributeiftheactivityisrunningin multi-windowmode.Thevaluecanbeanyoneofthefollowingstrings:......