gridcontrol 添加行号
gridcontrol 添加行号
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();
}
}
有时候行号宽度不够 还需要设置: gridView1.IndicatorWidth = 75;