title: How to show static text correctly on MFC CToolBar using TBSTYLE_FLAT?
body: <p>I'm using VS2005 and MFC.  I followed some code online for adding static text to the toolbar. However with the style set to TBSTYLE_FLAT or (TBSTYLE_FLAT | TBSTYLE_TRANSPARENT), the separator becomes visible and looks like a little tick mark above the text.  Is there a better way to show static text on the CToolBar or to make the separator invisible when behind the text?  Thanks!</p>
  
  <p><img src="https://i.imgur.com/RD10e.png" alt="screenshot"></p>
  
  <pre><code>int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  {
  if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
      return -1;
  
  if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT, WS_CHILD | WS_VISIBLE | CBRS_TOP
      | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
      !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  {
      TRACE0("Failed to create toolbar\n");
      return -1;      // fail to create
  }
  
  //Create Static Text
  CRect rect;
  int nIndex = m_wndToolBar.GetToolBarCtrl().CommandToIndex(ID_STATIC_TEST);
  m_wndToolBar.SetButtonInfo(nIndex, ID_STATIC_TEST, TBBS_SEPARATOR, 40);
  m_wndToolBar.GetToolBarCtrl().GetItemRect(nIndex, &amp;rect);
  rect.top = 5;
  rect.right = rect.left + 50;
  if(!m_static.Create("Test", WS_CHILD | WS_VISIBLE | SS_CENTER, rect, &amp;m_wndToolBar))
  {
      TRACE(_T("Failed to create Static Text\n"));
      return FALSE;
  }
  
  // TODO: Delete these three lines if you don't want the toolbar to be dockable
  m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  EnableDocking(CBRS_ALIGN_ANY);
  DockControlBar(&amp;m_wndToolBar);
  
  return 0;
  }
  </code></pre>