title: MFC CdockablePane Change Look
body: <p>I'm upgrading an old MFC project to use the MFC Feature Pack and Ribbon. I changed a pane derived from CControlBar to be derived from CDockablePane and it works great, however it still looks old and does not blend with the ribbon look and theme. The Pane also has buttons that still look old.</p>
  
  <p>How do I change the look, feel or theme of a CDockablePane derived object and buttons derived from CButton?</p>
  
  <p>I'm using the following code to draw the button, is the best way to simply change the background?</p>
  
  <pre><code>void CFolderButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
  {   
      UINT uState=DFCS_BUTTONPUSH;
      if( lpDrawItemStruct-&gt;itemState &amp; ODS_SELECTED )
      {
          uState|=DFCS_PUSHED;
      }
  
      //CDC dc;
      CDC* dc = CDC::FromHandle(lpDrawItemStruct-&gt;hDC);
  
  
      dc-&gt;DrawFrameControl(&amp;lpDrawItemStruct-&gt;rcItem,DFC_BUTTON,uState);
      if( !IsWindowEnabled() )
      {
          dc-&gt;SetTextColor(::GetSysColor(COLOR_3DSHADOW));        
      }
  
      CString csText;
      GetWindowText(csText);
  
      if (m_iDisplayType != 2 || !m_hIcon)
      {
          LOGFONT lf;
          memset(&amp;lf, 0, sizeof(LOGFONT)); 
          lf.lfHeight = m_iFontSize;                      
          strcpy(lf.lfFaceName, "Tahoma Bold");       
          VERIFY(font.CreateFontIndirect(&amp;lf));  
  
          CFont* def_font = dc-&gt;SelectObject(&amp;font);
  
          RECT buttonRect = lpDrawItemStruct-&gt;rcItem;
          buttonRect.left += 10;
          buttonRect.right += 10;
  
          if (m_iDisplayType != 1 || !m_hIcon) //text &amp; Icon
          {
              buttonRect.left += 30;
              buttonRect.right += 30;
          }   
          dc-&gt;DrawText(csText,&amp;buttonRect,DT_LEFT|DT_SINGLELINE|DT_VCENTER);  
  
          dc-&gt;SelectObject(def_font);
  
          font.DeleteObject();
      }
  
  
      if (m_hIcon &amp;&amp; m_iDisplayType != 1)
      {   
          CSize czText = dc-&gt;GetTextExtent(csText);
          dc-&gt;DrawIcon(0,0,m_hIcon);
      }
  }
  </code></pre>
  
  <p>The following image shows the contrast between the buttons and the ribbon:</p>
  
  <p><img src="https://i.stack.imgur.com/vChaq.jpg" alt="DockablePane contrast to ribbon"></p>