title: PreferredSize property doesn't match GetPreferredSize
body: <p>I am trying to write a menu item control that will AutoSize based on the length of text it contains (like the Label control).</p>
  
  <p>To do this, I overrided the GetPreferredSize method to calculate the length of the text:</p>
  
  <pre><code>    public override Size GetPreferredSize(Size proposedSize)
      {
          Size size = TextRenderer.MeasureText(this.Text, this.Font);
          int w = size.Width + this.Padding.Left + this.Padding.Right;
          int h = size.Height + this.Padding.Top + this.Padding.Bottom;
          return new Size(w, h);
      }
  </code></pre>
  
  <p>I then add a bunch of these controls to a containing menu control and try to position them based on the size above:</p>
  
  <pre><code>            if (item.AutoSize)
              {
                  item.Size = item.PreferredSize;
              }
  
              item.Left = _Left;
              item.Top = _Top;
  
              if (this.MenuOrientation == Orientation.Vertical)
              {
                  _Top += item.Size.Height;
              }
              else
              {
                  _Left += item.Size.Width;
              }
  
              this.Controls.Add(item);
  </code></pre>
  
  <p>However, the sizes returned by PreferredSize and GetPreferredSize aren't the same.  For one string, GetPreferredSize returns {Width=147, Height=27}, but PreferredSize returns {Width=105, Height=21}. Because of this the controls overlap instead of appearing beside one another.</p>
  
  <p>I tried overriding MinimumSize instead of GetPreferredSize, but that also got scaled down from what I calculated.</p>
  
  <p>So my question is, what is the correct way to do this?  I'd also like to understand the way that AutoSize, PreferredSize, MinimumSize, and MaximumSize are meant to interact.  MSDN is little help on this.</p>