title: Manual Painting Issue
body: <p>I'm having some strange drawing artefacts that I'm hoping someone might be able to help me pin down. </p>
  
  <p>Basically I have a left docked panel that is supposed to have a gradient background that hasn't been working right. I've changed the colours for debugging </p>
  
  <p><a href="http://img509.imageshack.us/img509/5650/18740614.png" rel="nofollow noreferrer">screenshot http://img509.imageshack.us/img509/5650/18740614.png</a>  </p>
  
  <p>The panel is docked left, and has a transparent control on it (hence you can see small stubs of red along the edges where the transparent control has correctly been painted, picking up the background colour).</p>
  
  <p>When I resize the panel slowly however, I get red lines left at the bottom, which I would expected to be covered up by yellow fills. The code I'm using is as follows:</p>
  
  <pre><code>// Construction
  sidePanel.Paint += new PaintEventHandler(OnPaint);
  
  private void OnPaint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
     Panel pb = sender as Panel;
     PaintControl(pb.Width, pb.Height, sender, e, true);
  }
  
  private static void PaintControl(int width, int height, object sender, PaintEventArgs e, bool sidebar)
  {
      Rectangle baseRectangle = new Rectangle(0, 0, width -1, height-1);
  
      using (LinearGradientBrush gradientBrush = new LinearGradientBrush(baseRectangle, WizardBaseForm.StartColour, WizardBaseForm.EndColour, 90))
      {
          e.Graphics.Clear(Color.Yellow);
          e.Graphics.DrawRectangle(Pens.Red, baseRectangle);
          e.Graphics.FillRectangle(Brushes.Yellow, baseRectangle);  
      }
  }
  
  protected override void OnResize(EventArgs e)
  {
     base.OnResize(e);
     this.Invalidate();
  }
  </code></pre>
  
  <p>The overall effect of this is I'm not getting either a nice solid colour, or a nice gradient fill when I resize. </p>