gridView显示行号

1、设置显示编号的宽度

   IndicatorWidth设置成所适合大小

2、在CustomDrawRowIndicator事件中编写如下代码

  #region 设置行号

        private void gvUser_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
        {
            int rowIndex = e.RowHandle;
            if(rowIndex>=0)
            {
                 rowIndex++;
                e.Info.DisplayText = rowIndex.ToString();
            }
            e.Info.ImageIndex = -1;
        }

 #endregion

你可能感兴趣的:(object)