Private Sub dg_RowPostPaint(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowPostPaintEventArgs) _
Handles DataGridView1.RowPostPaint
'สร้างเลขบรรทัด
Using b As SolidBrush = New SolidBrush(DataGridView1.RowHeadersDefaultCellStyle.ForeColor)
e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture), _
sender.DefaultCellStyle.Font, _
b, _
e.RowBounds.Location.X + 21, _
e.RowBounds.Location.Y + 3, _
New StringFormat(StringFormatFlags.DirectionRightToLeft))
End Using
End Sub