DataGridView增加序号

来源:互联网 发布:淘宝店上传完宝贝 编辑:程序博客网 时间:2024/05/22 13:35
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)        {            SolidBrush brush = new SolidBrush(dataGridView1.RowHeadersDefaultCellStyle.ForeColor);            int line = 0;            line = e.RowIndex + 1;            string s_line = line.ToString();            e.Graphics.DrawString(s_line,e.InheritedRowStyle.Font,brush,e.RowBounds.Location.X+15,e.RowBounds.Location.Y+5);        }

原创粉丝点击