title: How can I generate dinamically a button grid in a winform application which fits to the window size
body: <p>I tried many versions, but most of the tutorials are made for wpf apps. 
  Anyway, I can make some kind of grid, but some buttons are out of the form, and the spaceng among them is too large (And of course, if I resize the form, the grid still in the same size).</p>
  
  <p>Here's on of my tries, which isn't works correctly:</p>
  
  <pre><code>int size = 32;
  _buttonGrid = new Button[size, size];
  for (Int32 i = 0; i &lt; size; i++)
      for (Int32 j = 0; j &lt; size; j++)
      {
          _buttonGrid[i, j] = new Button();
          _buttonGrid[i, j].Location = new Point( size * j,  size * i); 
          _buttonGrid[i, j].Size = new Size(flowLayoutPanel1.Width / size, flowLayoutPanel1.Height / size); 
          _buttonGrid[i, j].Font = new Font(FontFamily.GenericSansSerif, 6, FontStyle.Bold); 
          _buttonGrid[i, j].Enabled = true; 
          _buttonGrid[i, j].TabIndex = 10 + i * size + j; 
          _buttonGrid[i, j].FlatStyle = FlatStyle.Flat; stípus
  
          flowLayoutPanel1.Controls.Add(_buttonGrid[i, j]);
      }
  </code></pre>