title: Vb.NET : Draw row number in list view
body: <p>Greeting everyone, I have a question regarding drawing row numbers in ListView like I did in DataGridView. I'm using Visual Studio 2010.</p>
  
  <p>In my DataGridView, I draw the row number using this code :</p>
  
  <pre><code>Private Sub SalesDGV_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles SalesDGV.RowPostPaint
      'draw the row number
      Using b As SolidBrush = New SolidBrush(SalesDGV.RowHeadersDefaultCellStyle.ForeColor)
          e.Graphics.DrawString(e.RowIndex + 1, _
                                 SalesDGV.DefaultCellStyle.Font, _
                                 b, _
                                 e.RowBounds.Location.X + 20, _
                                 e.RowBounds.Location.Y + 4)
      End Using
  End Sub
  </code></pre>
  
  <p>And the result in my DataGridView: <a href="http://puu.sh/3h4CF.png" rel="nofollow">http://puu.sh/3h4CF.png</a></p>
  
  <p>I want my ListView row numbers have the exact same style as my DataGridView, but it seem that ListView doesn't support such style in default and I need a custom control (?) </p>
  
  <p>I know some people will suggest me to use back DataGridView instead, but the reason I use ListView instead is that because DataGridView will give me void area if I don't populate data, while ListView allow me to have GridLines without populating any data.</p>
  
  <p>So I have two question here :</p>
  
  <ul>
  <li>How do I draw row headers with numbers in ListView like I did in DataGridView?</li>
  <li>Can I have gridlines display in DataGridView even through I don't populate any data? If possible, how can I achieve it?</li>
  </ul>
  
  <p>Thanks!</p>