Search code examples
refreshmfc-feature-packcmfcribbonpanel

How to refresh the CMFCRibbonBar after adding/updating an item


After adding a ribbon item, or calling a method that updates an item, the ribbon does not refresh correctly. Sometimes it's OK after resizing the window but most of the time the panel is in a collapsed state.

I tried all the functions I could think of, ReposPanels, RecalcWidths, RecalcLayout etc etc but nothing worked...


Solution

  • This worked for me:

        m_ribbonBar.ForceRecalcLayout(); //CMFCRibbonBar m_ribbonBar;