zoukankan      html  css  js  c++  java
  • cxTreeList添加行号转载

    cxTreeList添加行号(2011-11-17 15:59:38)转载
    与cxGrid添加行号类似:

    1.将TcxTreeList的OptionsView --> Indicator设置为true,另也可在这将indicatorWidth根据自己需要设置

    2.添加OnCustomDrawIndicatorCell事件:

    procedure TFTest.qtxmListCustomDrawIndicatorCell(Sender: TcxCustomTreeList;
      ACanvas: TcxCanvas; AViewInfo: TcxTreeListIndicatorCellViewInfo;
      var ADone: Boolean);
    var
      AIndicatorViewInfo: TcxTreeListIndicatorCellViewInfo;
      ATextRect: TRect;
      aCV:TcxCanvas;
    begin
      inherited;
      if not (AViewInfo is TcxTreeListIndicatorCellViewInfo) then Exit;
      aCV:=ACanvas ;
      ATextRect:=AViewInfo.TextBounds;
      AIndicatorViewInfo := AViewInfo as TcxTreeListIndicatorCellViewInfo;
      InflateRect(ATextRect, -2, -1);
      if AIndicatorViewInfo.Node=nil then exit;
      Sender.LookAndFeel.Painter.DrawHeader(ACanvas, AViewInfo.TextBounds,
        ATextRect, [], cxBordersAll, cxbsNormal, taCenter, TcxAlignmentVert(vaCenter),
        False, False, IntToStr(AIndicatorViewInfo.Node.AbsoluteIndex + 1),
        acv.Font,acv.font.Color,acv.Brush.Color);
      ADone := True;
    end;

    请引用cxClasses这个单元

    procedure Tfrm_MainIPC.dxGrd_Component2CustomDrawIndicatorCell(
    Sender: TObject; ACanvas: TcxCanvas;
    AViewInfo: TcxTreeListIndicatorViewInfo; var ADone: Boolean);
    var
    // AIndicatorViewInfo: TcxTreeListIndicatorCellViewInfo;
    AIndicatorViewInfo: TcxTreeListIndicatorViewInfo;
    ATextRect: TRect;
    aCV:TcxCanvas;
    begin
    inherited;
    if not (AViewInfo is TcxTreeListIndicatorViewInfo) then Exit;
    aCV:=ACanvas ;
    ATextRect:=AViewInfo.BoundsRect;
    AIndicatorViewInfo := AViewInfo as TcxTreeListIndicatorViewInfo;
    InflateRect(ATextRect, -2, -1);
    if AIndicatorViewInfo.Node=nil then exit;
    AViewInfo.LookAndFeelPainter.DrawHeader(ACanvas, AViewInfo.BoundsRect,
    ATextRect, [], cxBordersAll, cxbsNormal, taCenter, TcxAlignmentVert(vaCenter),
    False, False, IntToStr(AIndicatorViewInfo.Node.AbsoluteIndex + 1),
    acv.Font,acv.font.Color,acv.Brush.Color);
    // Sender.LookAndFeel.Painter.DrawHeader(ACanvas, AViewInfo.TextBounds,
    // ATextRect, [], cxBordersAll, cxbsNormal, taCenter, TcxAlignmentVert(vaCenter),
    // False, False, IntToStr(AIndicatorViewInfo.Node.AbsoluteIndex + 1),
    // acv.Font,acv.font.Color,acv.Brush.Color);
    ADone := True;
    end;

    需要单元

    cxInplaceContainer,  dxCoreGraphics, dxOffice11

  • 相关阅读:
    安全编码1
    VPP tips
    VPP概述汇总
    C语言安全编码摘录
    TCP-proxy
    Scipy Lecture Notes学习笔记(一)Getting started with Python for science 1.4. Matplotlib: plotting
    Scipy Lecture Notes学习笔记(一)Getting started with Python for science 1.3. NumPy: creating and manipulating numerical data
    Scipy Lecture Notes学习笔记(一)Getting started with Python for science 1.2. The Python language
    Scipy Lecture Notes学习笔记(一)Getting started with Python for science 1.1. Python scientific computing ecosystem
    25马5跑道,求最快的五匹马的需要比赛的次数
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/3103122.html
Copyright © 2011-2022 走看看