放在主程序 入口处,
public Form1() { InitializeComponent(); gridView1.IndicatorWidth = 50; //<宽度值>官方推荐常用是30,至于多少自己根据自己的需求和喜好去修改宽度的大小。 }
则每次程序运行时都能正确完整的显示序列号。
附送2种方法。
private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e) { e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; if (e.Info.IsRowIndicator) { if (e.RowHandle >= 0) { e.Info.DisplayText = (e.RowHandle + 1).ToString(); } else if (e.RowHandle < 0 && e.RowHandle > -1000) { e.Info.Appearance.BackColor = System.Drawing.Color.AntiqueWhite; e.Info.DisplayText = "G" + e.RowHandle.ToString(); } } gridView1.IndicatorWidth = 60; #region MyRegion //if (e.Info.IsRowIndicator) //{ // e.Info.DisplayText = e.RowHandle.ToString(); //} //gridView1.IndicatorWidth = 30; #endregion }
时间: 2024-10-12 02:12:59