Title: "Implementing Row Numbering in a Wisej.Net DataGridView"

0
0

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

Attachment
  • You must to post comments
0
0

Hi Poya,

you can use the RowHeader for this:

rownumbering

 

 

 

 

 

 

 

 

 

 

 

 

 

Please find a sample attached.

Best regards
Frank

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.