Dev Grid 添加行号

在GridView的 CustomDrawRowIndicator事件(右击GridControl控件在 Run Desiger里的事件里有这个选项)中添加如下代码:
private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
  {
            if (e.Info.IsRowIndicator && e.RowHandle >= 0)
            {
                e.Info.DisplayText = e.RowHandle.ToString();
            }
}
要调整行号列的宽度只需要调整gridview1.Indicator>

你可能感兴趣的:(职场,grid,行号,休闲,dev)