title: Rectangle around selected ListView item
body: <p>I would like to draw a rectangle around the selected item in a ListView, due to reading somewhere that Microsoft recommends against changing the 'highlighted colour' of said item. However, I'm using the selectedIndexChanged event and when the actual listviewitem is drawn my rectangle disappears. An educated guess would suggest my rectangle is either behind it or has being cleared when it has being redrawn? So my question is, when would be the best time to actually draw the rectangle as so it is visible? my code so far can be seen below:</p>
  
  <pre><code> void lvMain_SelectedIndexChanged(object sender, EventArgs e)
      {
          if (lvMain.SelectedItems.Count &gt; 0)
          {
              if (lastSelectedItem == null) // First time called
              {
                  lastSelectedItem = (sender as System.Windows.Forms.ListView).SelectedItems[0];
                  DrawHighlightRectanlge(lastSelectedItem);
              }
              else
              {
                  // TODO: Remove previous highlight
                  lastSelectedItem = (sender as System.Windows.Forms.ListView).SelectedItems[0];
                  DrawHighlightRectanlge(lastSelectedItem);
              }
          }
      }
  
      internal void DrawHighlightRectanlge(System.Windows.Forms.ListViewItem item)
      {
          using (Graphics g = item.ListView.CreateGraphics())
          {                
              g.DrawRectangle(new Pen(Color.Red), new Rectangle(item.Position.X, item.Position.Y, item.Bounds.Width, item.Bounds.Height));
          }
      }
  </code></pre>
  
  <p>TIA</p>