Private Sub DataGridView1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting
If e.ColumnIndex < 0 And e.RowIndex >= 0 Then
e.Paint(e.ClipBounds, DataGridViewPaintParts.All)
Dim indexrect As Drawing.Rectangle = e.CellBounds
indexrect.Inflate(-2, -2)
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), e.CellStyle.Font, indexrect, e.CellStyle.ForeColor, TextFormatFlags.Right)
e.Handled = True
End If
End Sub
If e.ColumnIndex < 0 And e.RowIndex >= 0 Then
e.Paint(e.ClipBounds, DataGridViewPaintParts.All)
Dim indexrect As Drawing.Rectangle = e.CellBounds
indexrect.Inflate(-2, -2)
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), e.CellStyle.Font, indexrect, e.CellStyle.ForeColor, TextFormatFlags.Right)
e.Handled = True
End If
End Sub
[本日志由 tiancao1001 于 2011-10-05 01:19 PM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |