给Dev GridView 添加行号显示

给GridView添加CustomDrawRowIndicator事件代码
 private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
        {
            if (e.Info.IsRowIndicator && e.RowHandle >= 0)
            {
                e.Info.DisplayText = Convert.ToString(e.RowHandle + 1);
            }

        }

对GridView的IndicatorWidth属性设置,来调整行号显示列宽。

你可能感兴趣的:(DevExpress,gridView行号)