I want to implement numbering on the left side of the DataGridView. The image and code I have are written in VB.Net Winform. Can this be achieved in Wisej.Net?
Private Sub dgvMain_RowPostPaint(sender As Object, e As DataGridViewRowPostPaintEventArgs) Handles dgvMain.RowPostPaint
Dim color As Color = dgvMain.RowHeadersDefaultCellStyle.ForeColor
If dgvMain.Rows(e.RowIndex).Selected Then
color = dgvMain.RowHeadersDefaultCellStyle.SelectionForeColor
Else
color = dgvMain.RowHeadersDefaultCellStyle.ForeColor
End If
Dim b As SolidBrush = New SolidBrush(color)
e.Graphics.DrawString((e.RowIndex + 1).ToString(), e.InheritedRowStyle.Font, b, e.RowBounds.Location.X + 20, e.RowBounds.Location.Y + 6)
b.Dispose()
End Sub
Hi Poya,
you can use the RowHeader for this:
Please find a sample attached.
Best regards
Frank
Please login first to submit.