How to handle WM_PAINT properly, getting constant repainting
<p>I'm doing custom handling of WM_PAINT and WM_ERASEBKGD in the WndProc override in a Control.</p>

<pre><code>protected override void WndProc(ref Message m)
{
    if (m.Msg == 0xF)
    {
        // [Draw using stored hDC]

        m.Result = (IntPtr)1;
    }
    else if (m.Msg == 0x14)
    {
        m.Result = (IntPtr)1;
    }
    else
        base.WndProc(ref m);
}
</code></pre>

<p>It works fine except that it is called constantly, about 300 times a second, and if I allow the base to handle it, it is called once. What am I leaving out?</p>
