private static IntPtr WmNcPaint(IntPtr hwnd, IntPtr wparam, ref bool handled) { var hrgnClip = wparam == new IntPtr(1) ? IntPtr.Zero : wparam; var dcEx = NativeMethods.GetDCEx(hwnd, hrgnClip, 155); if (dcEx != IntPtr.Zero) { try { var nonClientFillColor = Colors.Black; var solidBrush = NativeMethods.CreateSolidBrush(nonClientFillColor.B << 16 | nonClientFillColor.G << 8 | nonClientFillColor.R); try { var relativeToWindowRect = GetClientRectRelativeToWindowRect(hwnd); relativeToWindowRect.Top = relativeToWindowRect.Bottom; relativeToWindowRect.Bottom = relativeToWindowRect.Top + 1; NativeMethods.FillRect(dcEx, ref relativeToWindowRect, solidBrush); } finally { NativeMethods.DeleteObject(solidBrush); } } finally { NativeMethods.ReleaseDC(hwnd, dcEx); } } handled = true; return(IntPtr.Zero); }