title: datagridview not autoresizing properly
body: <p>I'm trying to autosize my dgv's width and height,
  However, it leaves me with big spaces in width, something isn't right.</p>
  
  <p>This is the code I'm using:</p>
  
  <pre><code>int height = 0;
  foreach (DataGridViewRow row in dgv.Rows)
  {
      height += row.Height;
  }
  height += dgv.ColumnHeadersHeight;
  
  int width = 0;
  foreach (DataGridViewColumn col in dgv.Columns)
  {
      width += col.Width;
  }
  width += dgv.RowHeadersWidth;
  
  dgv.ClientSize = new Size(width + 2, height + 2);
  </code></pre>
  
  <p><a href="http://image.prntscr.com/image/1cf9d102ef314fc9bdd88cb7bbe563ba.png" rel="nofollow noreferrer">dgv with spaces in width -  example 1 </a></p>
  
  <p><a href="http://image.prntscr.com/image/d8806060d9bb45f595fb95e299348590.png" rel="nofollow noreferrer">dgv with spaces in width -  example 2</a></p>