title: Should I receive WM_NCPAINT when there is no client area?
body: <p>There is something I would like to understand in my custom control. I handle WM_NCCALCSIZE to set the client area to the entire window, in other terms there is no nonclient area. I was expecting to not receive WM_NCPAINT but I still receive it each time the window size changes. Here is my WndProc code:</p>
  
  <pre><code>if (m.Msg == Win32Calls.WM_NCPAINT)
  {
      // I don't know why WM_NCPAINT is sent when WM_NCCALCSIZE has stated that there is no client area, so here is my workaround to stop processing here
      if (Bounds.Size == ClientSize)
          return;
  
      // Draw borders if any
  
      if (handled)
          return;
  }
  else if (m.Msg == Win32Calls.WM_NCCALCSIZE)
  {
      if (m.WParam != IntPtr.Zero)
      {
          Win32Calls.NCCALCSIZE_PARAMS csp;
  
          csp = (Win32Calls.NCCALCSIZE_PARAMS)Marshal.PtrToStructure(m.LParam, typeof(Win32Calls.NCCALCSIZE_PARAMS));
          Rectangle rect = new Rectangle(csp.rgrc0.Left, csp.rgrc0.Top,
              csp.rgrc0.Right - csp.rgrc0.Left, csp.rgrc0.Bottom - csp.rgrc0.Top);
  
          _drawManager.NcCalcSize(ref rect);
  
          csp.rgrc0.Left = rect.X;
          csp.rgrc0.Right = rect.X + rect.Width;
          csp.rgrc0.Top = rect.Y;
          csp.rgrc0.Bottom = rect.Y + rect.Height;
          Marshal.StructureToPtr(csp, m.LParam, false);
      }
  }
  </code></pre>
  
  <p>So, when a resize occurs, I checked and WM_NCCALCSIZE is correctly received, _drawManager.NcCalcSize does not modify "rect", then WM_NCPAINT is received and I'm obliged to compare the bounds and client rect to check if any non client painting should occur. Is this normal?</p>