title: Remove control from Form: space is still occupied
body: <p>I have a Form and want to toggle show and hide the <code>RichTextBox</code>.
  If I hide the control, the control should give up the space reservation, but actually it doesn't. </p>
  
  <p>it is Removed, but the original space reserved by <code>rtbcontrol</code> is still visible as empty grey space.
  It seems, it affects only the Controls, which are anchored to the bottom.</p>
  
  <p>I made a small sample for demonstrating my problem:
  Desinger:</p>
  
  <pre><code>namespace HideShowTest
  {
      partial class Form1
      {
          /// &lt;summary&gt;
          /// Erforderliche Designervariable.
          /// &lt;/summary&gt;
          private System.ComponentModel.IContainer components = null;
  
          /// &lt;summary&gt;
          /// Verwendete Ressourcen bereinigen.
          /// &lt;/summary&gt;
          /// &lt;param name="disposing"&gt;True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.&lt;/param&gt;
          protected override void Dispose(bool disposing)
          {
              if (disposing &amp;&amp; (components != null))
              {
                  components.Dispose();
              }
              base.Dispose(disposing);
          }
  
          #region Vom Windows Form-Designer generierter Code
  
          /// &lt;summary&gt;
          /// Erforderliche Methode für die Designerunterstützung.
          /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
          /// &lt;/summary&gt;
          private void InitializeComponent()
          {
              this.richTextBox1 = new System.Windows.Forms.RichTextBox();
              this.button1 = new System.Windows.Forms.Button();
              this.button2 = new System.Windows.Forms.Button();
              this.button3 = new System.Windows.Forms.Button();
              this.SuspendLayout();
              // 
              // richTextBox1
              // 
              this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                          | System.Windows.Forms.AnchorStyles.Right)));
              this.richTextBox1.Location = new System.Drawing.Point(13, 126);
              this.richTextBox1.Name = "richTextBox1";
              this.richTextBox1.Size = new System.Drawing.Size(289, 80);
              this.richTextBox1.TabIndex = 0;
              this.richTextBox1.Text = "";
              // 
              // button1
              // 
              this.button1.Location = new System.Drawing.Point(13, 13);
              this.button1.Name = "button1";
              this.button1.Size = new System.Drawing.Size(92, 23);
              this.button1.TabIndex = 3;
              this.button1.Text = "top anchor";
              this.button1.UseVisualStyleBackColor = true;
              // 
              // button2
              // 
              this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
              this.button2.Location = new System.Drawing.Point(13, 75);
              this.button2.Name = "button2";
              this.button2.Size = new System.Drawing.Size(92, 23);
              this.button2.TabIndex = 2;
              this.button2.Text = "bottom anchor";
              this.button2.UseVisualStyleBackColor = true;
              // 
              // button3
              // 
              this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
              this.button3.Location = new System.Drawing.Point(227, 75);
              this.button3.Name = "button3";
              this.button3.Size = new System.Drawing.Size(75, 23);
              this.button3.TabIndex = 1;
              this.button3.Text = "Hide Rtb";
              this.button3.UseVisualStyleBackColor = true;
              this.button3.Click += new System.EventHandler(this.button3_Click);
              // 
              // Form1
              // 
              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
              this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
              this.ClientSize = new System.Drawing.Size(314, 226);
              this.Controls.Add(this.button1);
              this.Controls.Add(this.button2);
              this.Controls.Add(this.button3);
              this.Controls.Add(this.richTextBox1);
              this.Name = "Form1";
              this.Text = "Form1";
              this.ResumeLayout(false);
  
          }
  
          #endregion
  
          private System.Windows.Forms.RichTextBox richTextBox1;
          private System.Windows.Forms.Button button3;
          private System.Windows.Forms.Button button2;
          private System.Windows.Forms.Button button1;
      }
  }
  </code></pre>
  
  <p>and Code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  
  namespace HideShowTest
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button3_Click(object sender, EventArgs e)
          {
              if (richTextBox1.Visible)
              {
                  richTextBox1.Hide();
  
                  this.Height -= richTextBox1.Height;
              }
              else
              {
                  richTextBox1.Show();
  
                  this.Height += richTextBox1.Height;
              }
              button3.Text = richTextBox1.Visible ? "Hide Rtb" : "Show Rtb";
          }
      }
  }
  </code></pre>
  
  <p>If I click "Hide Rtb", the bottom anchor button wanders up (it should stay at the same place).</p>