title: New area not repaints when user-drawn control size is increased
body: <p>I think I'm missing something trivial here. I derived simple control directly from <code>Control</code>. I'm overriding <code>OnPaint</code> and painting the rectangle (<code>e.Graphics.DrawRectangle</code>)and a text inside it (<code>e.Graphics.DrawString</code>). I did not override any other members.</p>
  
  <p>It paints itself well when the control is resized to the smaller size, but when it gets resized to the larger size, new area is not repainted properly. As soon as I resize it to the smaller size again, even if by one pixel, everything repaints correctly.</p>
  
  <p><code>OnPaint</code> gets called properly (with appropriate <code>PaintEventArgs.ClipRectangle</code> set correctly to new area), but the new area is not painted (artifacts appear) anyway.</p>
  
  <p>What am I missing?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Code:</p>
  
  <pre><code>protected override void OnPaint(PaintEventArgs e)
  {
      // Adjust control's height based on current width, to fit current text:
  
      base.Height = _GetFittingHeight(e.Graphics, base.Width);
  
      // Draw frame (if available):
  
      if (FrameThickness != 0)
      {
          e.Graphics.DrawRectangle(new Pen(FrameColor, FrameThickness),
              FrameThickness / 2, FrameThickness / 2, base.Width - FrameThickness, base.Height - FrameThickness);
      }
  
      // Draw string:
  
      e.Graphics.DrawString(base.Text, base.Font, new SolidBrush(base.ForeColor), new RectangleF(0, 0, base.Width, base.Height));
  }
  
  private int _GetFittingHeight(Graphics graphics, int width)
  {
      return (int)Math.Ceiling(graphics.MeasureString(base.Text, base.Font, width).Height);
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Z8HXo.png" alt="WTF?"></p>