title: Draw ListView column headers separators?
body: <p>I'm trying to draw the column headers of a Listview in <code>details</code> mode.</p>
  
  <p>This code:</p>
  
  <pre><code>Public Sub Me_DrawColumnHeader(ByVal sender As Object, ByVal e As DrawListViewColumnHeaderEventArgs) _
  Handles Me.DrawColumnHeader
  
      e.DrawDefault = False ' Set ownerdraw.
  
      e.Graphics.FillRectangle(Brushes.SteelBlue, e.Bounds)
      e.DrawText()
  
  End Sub
  </code></pre>
  
  <p>Produces this:</p>
  
  <p><img src="https://i.stack.imgur.com/Tborn.jpg" alt="http://img189.imageshack.us/img189/8150/k5nm.jpg"></p>
  
  <p>But I would like to draw the vertical separator lines like windows does:</p>
  
  <p><img src="https://i.stack.imgur.com/wrBkS.jpg" alt="http://img571.imageshack.us/img571/7185/1iz9.jpg"></p>
  
  <blockquote>
    <p>UPDATE:</p>
  </blockquote>
  
  <p>I found a way to draw them:</p>
  
  <pre><code>e.Graphics.DrawLine(Pens.Black, e.Bounds.X, e.Bounds.Y, e.Bounds.Left, e.Bounds.Right)
  </code></pre>
  
  <p>But seems that does not have the same anchor.</p>
  
  <p>also notice that my header text is too close of the separator lines and also are upper than the original windows listview:</p>
  
  <p>Compare them:</p>
  
  <p>Own:</p>
  
  <p><img src="https://i.stack.imgur.com/wAb5P.jpg" alt="enter image description here"></p>
  
  <p>Original:</p>
  
  <p><img src="https://i.stack.imgur.com/skoY1.jpg" alt="enter image description here"></p>
  
  <p>This is the code that I'm using to draw the text:</p>
  
  <pre><code>    e.DrawDefault = False ' Set ownerdraw.
  
      Dim strFormat As New StringFormat()
  
      If e.Header.TextAlign = HorizontalAlignment.Center Then
          strFormat.Alignment = StringAlignment.Center
      ElseIf e.Header.TextAlign = HorizontalAlignment.Right Then
          strFormat.Alignment = StringAlignment.Far
      End If
  
      e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(120, 147, 73)), e.Bounds)
      e.Graphics.DrawString(e.Header.Text, e.Font, Brushes.Black, e.Bounds, strFormat)
      e.Graphics.DrawLine(Pens.Black, e.Bounds.X, e.Bounds.Y, e.Bounds.Left, e.Bounds.Right)
  </code></pre>