zoukankan      html  css  js  c++  java
  • cxgrid显示行号

    把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;

  • 相关阅读:
    测试随笔
    ECNU 3530 和你在一起
    ECNU 1030 母牛生小牛
    ECNU 3081 购房还款
    PPP模式下的融资结构优化
    决策树分类
    关联规则-R语言实现
    中国快递包裹总量的预测-基于SARIMA模型
    LeetCode 2 :Swap Nodes in Pairs
    2018092609-2 选题 Scrum立会报告+燃尽图 04
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/2940640.html
Copyright © 2011-2022 走看看