title: Autosizing WinForms Dialog to fit inner content
body: <p>I'm writing a kind of "generic container dialog", which will ensure that all modal dialogs in an app will have the exact same "chrome" (namely, buttons, icons, etc.). I came up with the following:</p>
  
  <p><img src="https://i.stack.imgur.com/96cZo.png" alt="alt text"></p>
  
  <p>The <code>containerPanel</code> is just a <code>System.Windows.Forms.Panel</code>.</p>
  
  <p>Now what I want is as follows: for each dialog in an app, I want to create a separate <code>UserControl</code> (not a full-blown <code>Form</code>) and then "host" it inside this generic dialog. To do so, I need to somehow make this dialog self-adjustable so that it would shrink or grow depending on the size of a control hosted inside it.</p>
  
  <p>How can I do that? Do I need some kind of layout control, or is there some special magical property to do this?</p>