`
dawuafang
  • 浏览: 1108707 次
文章分类
社区版块
存档分类
最新评论

DataGridView增加序号

 
阅读更多
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);
        }

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics