在GridView的CustomDrawRowIndicator事件中添加如下代码:
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.IndicatorWidth=35属性即可(注意改属性不是在上面的事件中设置)