title: CView as tab on CMFCTabCtrl, does not draw invalidated area (on dragging)
body: <p>I have a <code>CWinAppEx</code> MDI application, VS2017. The <code>ChiledFrame</code> is covered with (I altered the names for this question) <code>CMyView</code>:</p>
  
  <pre><code>pDocTemplate = new CMultiDocTemplate(   IDR_MYTYPE,
                                          RUNTIME_CLASS(CMyDoc),
                                          RUNTIME_CLASS(CMyChildFrame),
                                          RUNTIME_CLASS(CMyView));
  </code></pre>
  
  <p><code>CMyView</code> client-rect is covered with a <code>CMFCTabCtrl</code> (<code>m_wndTabs</code>): It has 2 tabs, objects of <code>CViewTest1</code> and <code>CViewTest2</code> classes (derived from MFC <code>CView</code>). This is the relevant part of <code>MyView::Create</code> function:</p>
  
  <pre><code>    CRect rectDummy;
      rectDummy.SetRectEmpty();
  
      // Create tabs window:
      if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_3D_ONENOTE, rectDummy, this, 1))
      {
          TRACE0("Failed to create output tab window\n");
          return -1;      // fail to create
      }
  
      // Create output panes ('300' value is dummy client-rect is updated on CViewTest1/2::OnSize):
  
      CViewTest1 *pWnd1 = (CViewTest1*)RUNTIME_CLASS(CViewTest1)-&gt;CreateObject();
      pWnd1-&gt;Create(nullptr, nullptr, LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE, CRect(0, 0, 300, 300), this, 1, pContext);
      pWnd1-&gt;SetFont(&amp;afxGlobalData.fontRegular);
  
      CViewTest2 *pWnd2 = (CViewTest2*)RUNTIME_CLASS(CViewTest2)-&gt;CreateObject();
      pWnd2-&gt;Create(nullptr, nullptr, LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE, CRect(0, 0, 300, 300), this, 2, pContext);
      pWnd2-&gt;SetFont(&amp;afxGlobalData.fontRegular);
  
      m_wndTabs.AddTab(pWnd1, L"Tab 1");
      m_wndTabs.AddTab(pWnd2, L"Tab 2");
  
      // Redraw tab 0 ("Tab 1"): &lt;--- Here already smells an issue.
      m_wndTabs.SetActiveTab(1); // (This need to move to 1 &amp; back to 0)
      m_wndTabs.SetActiveTab(0);
  </code></pre>
  
  <p>The <code>parent</code> of <code>CViewTest1</code> and <code>CViewTest2</code> objects is <code>CMyView</code> object.
  m_wndTabs resized to cover the whole client area at:</p>
  
  <pre><code>void CMyView::OnSize(UINT nType, int cx, int cy)
  {
      CView::OnSize(nType, cx, cy);
  
      if (m_wndTabs) // Tab control should cover the whole client area:
          m_wndTabs.SetWindowPos(nullptr, -1, -1, cx, cy, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
  
  }
  </code></pre>
  
  <p>Now, when I drag one child-frame over another, and back: The control-tab behaves as expected, but CViewTest1 object (on active tab) does not get OnDraw(). It looks like that:</p>
  
  <p><a href="https://i.stack.imgur.com/eNdF4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eNdF4.jpg" alt="enter image description here"></a></p>
  
  <p><strong>Any idea?</strong></p>