title: MFC toolbar: How to set dropdown button width
body: <p>I am developing an MFC-based C++ application using Visual Studio 2010. There is a <code>CToolBarCtrl</code> with some dropdown buttons next to icons.</p>
  
  <p>A user running Windows 8 has reported that they cannot see one of the icons in this toolbar. They provided a screenshot which shows that they are running Windows 8 at 150% UI zoom. My application is currently set to not be DPI-aware so this should actually not make a difference. (EDIT: apparently it does make a difference, after all - they no longer have the problem when switching to 96 DPI.)</p>
  
  <p>As can be seen in the screenshots below, the toolbar dropdown buttons are much wider on their Windows installation than they should be. The spacing between the icons in the left toolbar is thus so big that the last icon cannot be seen anymore. The right toolbar in the screenshot (which does not have any dropdown buttons) appears as intended.</p>
  
  <p>Mine (as it should be):</p>
  
  <p><a href="https://i.stack.imgur.com/u2ezP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u2ezP.png" alt="Toolbar as I see it"></a></p>
  
  <p>Theirs (dropdown buttons too wide):</p>
  
  <p><a href="https://i.stack.imgur.com/gtMuX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gtMuX.png" alt="Toolbar as they see it"></a></p>
  
  <p>My application already sets the icon (16x16) and button (27x24) sizes, but that obviously does not affect the dropdown button size.</p>
  
  <p>So my question is: Why is it possible that the dropdown buttons can be wider than on my default Windows installation, and how can I change them to be the default size so that all icons fit into the toolbar? I didn't find any API that could actually set the toolbar dropdown button width.</p>
  
  <p>Init code in my class derived from <code>CToolBarCtrl</code>:</p>
  
  <pre><code>SetButtonStructSize(sizeof(TBBUTTON));
  SetBitmapSize(CSize(16, 16));
  SetButtonSize(CSize(27, 24));
  
  SetImageList(&amp;icons);
  SetDisabledImageList(&amp;disabledIcons);
  
  LONG lStyleOld = GetWindowLong(m_hWnd, GWL_STYLE);
  lStyleOld |= CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NODIVIDER | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT;
  SetWindowLong(m_hWnd, GWL_STYLE, lStyleOld);
  </code></pre>