网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 网络学院 >> 程序设计 >> Delphi编程 >> 文章正文
  为cxGrid增加行号            【字体:
为cxGrid增加行号
作者:佚名    文章来源:不详    点击数:    更新时间:2007-9-12    
正在装载数据……

其实这个方法就是cxGrid范例中提供的,原范例在CellLevelMultiselectDemo目录下

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




本文来源:http://blog.csdn.net/estudy2008/archive/2007/08/09/1733546.aspx
站内文章搜索 高级搜索
文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
     在delphi中使用xml文档有…
     初探delphi 7 中的插件编…
     delphi 2006(dexter) & …
     获得windows的版本信息。
     “序列号输入助手”源代…
     rs232串口通讯模块
     ado方式下判断数据表是否…
  • Struts2学习:在struts2中集…

  • 设计模式之--Bridge

  • Ant入门-配置和使用     选…

  • 浅析Spring框架下PropertyPl…

  • SPRING+STRUTS+HIBERNATE登录…

  • 根据sessionid找回session

  • 摘:主题:   using springmo…

  • 在spring MVC中配置多个视图

  • 看完了第二遍C++Primer,学习…

  • Solaris10下,使用SunStudio…

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    网络学院©2007 www.23book.net
    为您提供web编程,vb编程,vc编程,服务器架设管理,数据库设计等方面的知识 站长:David