GridControl的作用笔记

2.girdView在第一列显示行号

//调整第一列的宽度
this.gridView1.IndicatorWidth = 40;
//添加监听事件
this.gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(this.gridView1_CustomDrawRowIndicator);
//在非类里这段代码
private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
        ...{
            if (e.Info.IsRowIndicator && e.RowHandle >= 0)
            ...{
                e.Info.DisplayText = Convert.ToString(Convert.ToInt32(e.RowHandle.ToString())+1);
            }
        }

你可能感兴趣的:(grid)