zoukankan      html  css  js  c++  java
  • GridView 显示行号 设置行号列的宽度

    /// <summary>
    /// GridView 显示行号 设置行号列的宽度
    /// </summary>
    /// <param name="gv">GridView 控件名称</param>
    /// <param name="width">行号列的宽度 如果为null或为0 默认为30</param>
    public void DrawRowIndicator(DevExpress.XtraGrid.Views.Grid.GridView gv, int width) {
    gv.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gv_CustomDrawRowIndicator);
    if (width != null)
    {
    if (width != 0)
    {
    gv.IndicatorWidth = width;
    }
    else {
    gv.IndicatorWidth = 30;
    }
    }
    else {
    gv.IndicatorWidth = 30;
    }

    }
    //行号设置
    private void gv_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e) {
    if (e.Info.IsRowIndicator && e.RowHandle > -1) {
    e.Info.DisplayText = (e.RowHandle + 1).ToString();
    }
    }

    调用:

    DrawRowIndicator(gridView1, 30);  

    备注:

    显示行号可以直接给GridView添加CustomRowIndicator事件 ,即上面的“行号设置”方法。

  • 相关阅读:
    Bacula Plugins
    getopt、getopt_long命令参数
    Notepad++ 快捷键
    make命令
    Linux目录结构
    rhel安装输入法
    libtool编译
    install和cp
    dlopen动态链接库操作
    结构体赋值
  • 原文地址:https://www.cnblogs.com/denny-x/p/9075107.html
Copyright © 2011-2022 走看看