/// <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(); } }