DevExpress Gridcontrol显示序号列,用 gridView1_CustomDrawRowIndicator 的事件来实现。具体代码如下:

#region gridView1_CustomDrawRowIndicator
        /// <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();
            }
        }
        #endregion

序号列的宽度设置gridView 的IndicatorWidth属性即可。

相关文章:

  • 2021-12-17
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2021-11-13
  • 2022-12-23
  • 2019-12-19
相关资源
相似解决方案