1 //冻结将自增长列
2 this.DataGridView.Columns[0].Frozen = true;
3 
4 private void DataGridView_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
5 {
6             SolidBrush b = new SolidBrush(this.DataGridView.RowHeadersDefaultCellStyle.ForeColor);
7             e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture), this.DataGridView.DefaultCellStyle.Font, b, e.RowBounds.Location.X + 50, e.RowBounds.Location.Y + 4);
8 }

 

posted on 2012-05-11 12:11  捣乃忒  阅读(499)  评论(0编辑  收藏  举报