protected override void WndProc(ref Message m) { IntPtr preR = m.Result; // Ignore focus if (m.Msg == 7 /* WM_SETFOCUS */) { return; } else if (m.Msg == 0x000f /* WM_PAINT */) { this.realUpdateRects = UI.GetUpdateRegion(this); if (realUpdateRects != null && realUpdateRects.Length >= 5) // '5' chosen arbitrarily { this.realUpdateRects = null; } base.WndProc(ref m); } else { base.WndProc(ref m); } }