0

I'm using CMFCRibbonBar in an MFC based Application, I would like to add the ability to collapse the ribbon like you can in Office, does anyone know if this can be done?

image of ribbon bar in office

I would be quite happy if I it was only possible to implement the button in the menu bar like in explorer/mspaint

windows 10 explorer view

MyDeveloperDay
  • 2,485
  • 1
  • 17
  • 20

1 Answers1

2

Sorry to answer my own question, seems you just drop a CMFCRibbonButton above the ribbon bar, give it an id, then in the event handler call

m_wndRibbonBar.ToggleMimimizeState();

Now to determine how I can change the button image on toggling

MyDeveloperDay
  • 2,485
  • 1
  • 17
  • 20
  • *"Now to determine how I can change the button image on toggling"* - found any way? – peterchen Jun 11 '17 at 06:09
  • 1
    The only way I found was to make my own button which inherits from CMFCRibbonButton, then overloaded the virtual void DrawImage(CDC *pDC,RibbonImageType, CRect rectImage) method, in that method I called m_pParentGroup->OnDrawImage() and at that point I switched the image index based on if the bar was up or down. hope that helps – MyDeveloperDay Jun 14 '17 at 18:57