效果:
实现方法:
//设置序号列的宽度
gridView1.IndicatorWidth = 50;
private void gridView1_CustomDrawRowIndicator ( object sender ,DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e )
{
if ( e.Info.Kind == DevExpress.Utils.Drawing.IndicatorKind.Header )
{
e.Appearance.DrawBackground( e.Cache ,e.Bounds );
e.Appearance.DrawString( e.Cache ,"序号" ,e.Bounds );
e.Handled = true;
}
if ( e.Info.IsRowIndicator && e.RowHandle >= 0 )
{
e.Info.DisplayText = ( e.RowHandle + 1 ).ToString( );
}
}