首页 > Windows开发 > 详细

Winform 程序中DataGridView 控件添加行号

时间:2014-12-22 14:21:14      阅读:265      评论:0      收藏:0      [点我收藏+]

 private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)     

    {            

   Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,                 e.RowBounds.Location.Y,     dataGridView1.RowHeadersWidth,                 e.RowBounds.Height);    

            TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),                 dataGridView1.RowHeadersDefaultCellStyle.Font,                 rectangle,                 dataGridView1.RowHeadersDefaultCellStyle.ForeColor,                 TextFormatFlags.VerticalCenter |             TextFormatFlags.Right);        

}

Winform 程序中DataGridView 控件添加行号

原文:http://www.cnblogs.com/xakml/p/RowNo.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!