您的位置:首页 > 编程语言 > Delphi

delphi 如何让tcxGrid左边显示序号

2017-09-20 16:09 134 查看
第一步:

设置cxgrid的属性, OptionsView.Indicator = True

第二步:

写OnCustomDrawIndicatorCell方法

var

  FValue: string;

  FBounds: TRect;

begin

  if (AViewInfo is TcxGridIndicatorRowItemViewInfo) then

  begin

    FValue :=IntToStr(TcxGridIndicatorRowItemViewInfo(AViewInfo).GridRecord.Index+1);

    FBounds := AViewInfo.Bounds;

    ACanvas.FillRect(FBounds);

    ACanvas.DrawComplexFrame(FBounds, clBtnHighlight, clBtnShadow, [bBottom, bLeft, bRight], 1);

    InflateRect(FBounds, -1, -1);

    ACanvas.Font.Color := clBlack;

    ACanvas.Brush.Style := bsClear;

    ACanvas.DrawText(FValue, FBounds, cxAlignCenter or cxAlignTop);

    ADone := True;

  end;

end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐