title: How to change language at runtime without layout troubles
body: <p>I have a winforms application that the users must be able to change the language at runtime.</p>
  
  <p>To generalize the switch and avoid having to hard code control names I tried the following extension:</p>
  
  <pre><code>    internal static void SetLanguage(this Form form, CultureInfo lang)
      {
          ComponentResourceManager resources = new ComponentResourceManager(form.GetType());
  
          ApplyResourceToControl(resources, form, lang);
          resources.ApplyResources(form, "$this", lang);
      }
  
      private static void ApplyResourceToControl(ComponentResourceManager resources, Control control, CultureInfo lang)
      {
          foreach (Control c in control.Controls)
          {
              ApplyResourceToControl(resources, c, lang);
              resources.ApplyResources(c, c.Name, lang);
          }
      }
  </code></pre>
  
  <p>This does change all the strings.</p>
  
  <p>However a side effect of this is that the entire contents of the window is resized to that windows original startup size, no matter what the current size is.</p>
  
  <p>How can I prevent the layout from changing or initiate a new layout calculation?</p>