Devexpress设置gridcontrol行号

 if (e.Info.IsRowIndicator && e.RowHandle > -1)

        {

                e.Info.DisplayText = (e.RowHandle + 1).ToString();

        }

        public void DrawRowIndicator(DevExpress.XtraGrid.Views.Grid.GridView gv, int width)

        {

            gv.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView1_CustomDrawRowIndicator);

            if (width != 0)

            {

                if (width != 0)

                {

                    gv.IndicatorWidth = width;

                }

                else

                {

                    gv.IndicatorWidth = 30;

                }

            }

            else

            {

                gv.IndicatorWidth = 30;

            }

        }

 DrawRowIndicator(gridView1, 50);

你可能感兴趣的:(C#基础,开发语言,c#,Devexpress)