DevExpress GridControl 自动添加行号

        /// <summary>
        /// 表示每行生成的时候随绘制这一行数据的时候触发
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
        {
            if (e.Info.IsRowIndicator && e.RowHandle >= 0)//在表格前面加行号
            {
                e.Info.DisplayText = (e.RowHandle + 1).ToString();
            }
        }

  

posted @ 2021-01-14 17:05  aBung  阅读(492)  评论(0编辑  收藏  举报