title: Fill screen with cells in datagrid depending on size of screen
body: <p>I have put a datagridview into my windows form. I measure width and height of the screen and then I draw empty cells on the screen. That works fine, problem is that I don't know how much cells I can put on my screen depending on width and height. I get a lot more cells then I should. When I draw them I'am getting more cells than size of my screen on my right and on the bottom of my screen.</p>
  
  <p>I'll put some code so you can see what I am talking about:</p>
  
  <pre><code>public static int height= Screen.PrimaryScreen.Bounds.Height;
  public static int width= Screen.PrimaryScreen.Bounds.Width;
  
  public void draw()
  {
      number_of_cells_width = width/ 5;  //I have put number 5 because I think they are 5x5 by default size
      number_of_cells_height = height / 5;
      for (int i = 0; i &lt; number_of_cells_width ; i++)
      {
          grid.Columns.Add("", "");
      }
      for (int i = 0; i &lt; number_of_cells_height ; i++)
      {
          grid.Rows.Add("");
      }
  }
  </code></pre>
  
  <p>And I have put datagridview to fill my parent.
  So I get a lot more cells then I should. Any idea how to fix this?</p>
  
  <p>I think some dividing should do the job. But I don't see what I have done wrong.</p>
  
  <p>Thank you</p>