DataGridView显示行号
Posted rf8862
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DataGridView显示行号相关的知识,希望对你有一定的参考价值。
Private Sub DataGridView1_RowPostPaint(sender As Object, e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint Dim Rectangle As Rectangle = New Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, DataGridView1.RowHeadersWidth - 4, e.RowBounds.Height) TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), DataGridView1.RowHeadersDefaultCellStyle.Font, Rectangle, DataGridView1.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.HorizontalCenter + TextFormatFlags.VerticalCenter) End Sub
以上是关于DataGridView显示行号的主要内容,如果未能解决你的问题,请参考以下文章