放在主程序 入口處,
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
}