/// <summary> /// The Windows group box doesn't erase the background so we do it /// ourselves here. /// </summary> /// <internalonly/> private void WmEraseBkgnd(ref Message m) { NativeMethods.RECT rect = new NativeMethods.RECT(); SafeNativeMethods.GetClientRect(new HandleRef(this, Handle), ref rect); using (Graphics graphics = Graphics.FromHdcInternal(m.WParam)) { using (Brush b = new SolidBrush(BackColor)) { graphics.FillRectangle(b, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); } } m.Result = (IntPtr)1; }