C# OnPaint leaves trails when resizing
<p>I am creating a form with custom border.
I wanted to draw my own border using onPaint override.
Unfortunately, I get trails of image when I just use the below code.</p>

<p>Does anyone know how to fix this?
And yes, I have set the DoubleBuffered to true.</p>

<pre><code>    protected override void OnPaint(PaintEventArgs e)
    {
        Graphics g = e.Graphics;

        // Background
        g.FillRectangle(new SolidBrush(ColorTranslator.FromHtml("#EFEFF7")), new Rectangle(0, 0, this.Width - 1, this.Height - 1));

        // Outer Borders
        g.DrawImage(Resources.Resource.OuterBorderTopLeft, new Rectangle(0, 0, 13, 13));
        g.DrawImage(Resources.Resource.OuterBorderTopLeft1, new Rectangle(13, 0, 221, 13));
        g.DrawImage(Resources.Resource.OuterBorderTopLeft2, new Rectangle(0, 13, 13, 221));
        g.DrawImage(Resources.Resource.OuterBorderTopRight, new Rectangle(this.Size.Width - 13, 0, 13, 13));
        g.DrawImage(Resources.Resource.OuterBorderTopRight1, new Rectangle(this.Size.Width - 13, 13, 13, 221));
        g.DrawImage(Resources.Resource.OuterBorderTopRight2, new Rectangle(this.Size.Width - 234, 0, 221, 13));
        g.DrawImage(Resources.Resource.OuterBorderBottomLeft, new Rectangle(0, this.Size.Height - 13, 13, 13));
        g.DrawImage(Resources.Resource.OuterBorderBottomLeft1, new Rectangle(0, this.Size.Height - 234, 13, 221));
        g.DrawImage(Resources.Resource.OuterBorderBottomLeft2, new Rectangle(13, this.Size.Height - 13, 221, 13));
        g.DrawImage(Resources.Resource.OuterBorderBottomRight, new Rectangle(this.Size.Width - 13, this.Size.Height - 13, 13, 13));
        g.DrawImage(Resources.Resource.OuterBorderBottomRight1, new Rectangle(this.Size.Width - 234, this.Size.Height - 13, 221, 13));
        g.DrawImage(Resources.Resource.OuterBorderBottomRight2, new Rectangle(this.Size.Width - 13, this.Size.Height - 234, 13, 221));

        base.OnPaint(e);
    }
</code></pre>
