title: Winforms - How to alternate the color of rows in a ListView control?
body: <p>Using C# Winforms (3.5).</p>
  
  <p>Is it possible to set the row colors to automatically alternate in a listview?</p>
  
  <p>Or do I need to manually set the row color each time a new row is added to the listview?</p>
  
  <p>Based on a <a href="http://msdn.microsoft.com/zh-cn/library/ms750769(VS.85).aspx" rel="noreferrer">MSDN</a> article the manual method would look like this:</p>
  
  <pre><code>//alternate row color
  if (i % 2 == 0)
  {
      lvi.BackColor = Color.LightBlue;
  }
  else
  {
      lvi.BackColor = Color.Beige;
  }
  </code></pre>