DataGridView控件行标题显示序号

 Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, dataGridViewX1.RowHeadersWidth - 4, e.RowBounds.Height);
            TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), dataGridViewX1.RowHeadersDefaultCellStyle.Font, rectangle, dataGridViewX1.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);

posted @ 2016-12-09 17:37  Elcser  阅读(1247)  评论(0编辑  收藏  举报