title: When is Panel.Size updated after adding controls when Panel.AutoSize = true?
body: <p>I'm creating a GUI in <em>C#</em> using <em>WinForms</em>.<br>
  I'm trying to position programaticaly created panels one below the other. As the content of these panel can vary depending on their content, I'm using <code>Panel.AutoSize</code> to let WinForms perform the correct resizing.</p>
  
  <p>The problem is: if I'm using <code>Panel.Height</code> (or <code>Panel.Size.Height</code>) right after populating the <code>Panel</code>, the value returned is always my default value. The resizing do occur, as I can see when launching the app, but I just don't know when.</p>
  
  <p>Here's a simplified version of what I'm doing:</p>
  
  <pre><code>this.SuspendLayout();
  
  int yPos = 0;
  foreach (String entry in entries)
  {
      Panel panel = new Panel();
      panel.SuspendLayout();
      panel.AutoSize = true;
      panel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowOnly;
      panel.BackColor = System.Drawing.SystemColors.Window; // Allows to see that the panel is resized for dispay
      panel.Location = new System.Drawing.Point(0, yPos);
      panel.Size = new System.Drawing.Size(this.Width, 0);
      this.Controls.Add(panel);
  
      Label label = new Label();
      label.AutoSize = true;
      label.Location = new System.Drawing.Point(0, 0);
      label.MaximumSize = new System.Drawing.Size(panel.Width, 0);
      label.Text = entry;
      panel.Controls.Add(label);
  
      panel.ResumeLayout(false);
      panel.PerformLayout();
  
      yPos += panel.Height; // When breaking here, panel.Height is worth 0
      yPos += label.Height; // This works perfectly, label.Height was updated according to the text content when breaking at that point
  }
  
  this.ResumeLayout(false);
  this.PerformLayout();
  </code></pre>
  
  <p>So the real question is: How can I get the updated <code>Panel.Size</code> after adding controls to it, to get its proper height value?</p>
  
  <p><em>Note: I know I can use the <code>TextBox</code> height, but I find it inelegant and impractical, as in my actual code there are more controls in the <code>Panel</code> and I need to use that panel height a few lines below.</em></p>