关于 Launch Button
That is the bottom right corner of the small arrowed buttons on a small panel
And they had just learning programming, it is a problem for a long time, until one day went to see the MFC Ribbon source.
Since this button does not get in the Ribbon editor directly, there should be a lot of people will encounter the same problem with my
Luckily MFC Ribbon provides this button, you can directly use the code to enable it
Start a way to code the way
After CMFCRibbonBar control is initialized, call the corresponding CMFCRibbonPanel :: EnableLaunchButton () method
// 找到 Panel
auto panel = m_wndRibbonBar.GetCategory(1)->GetPanel(0);
// 启用 LaunchButton
panel->EnableLaunchButton(ID_VIEW_OPTION);
You must be defined in resource.h in ID_VIEW_OPTION
// 在 Resource.h 中
#define ID_VIEW_OPTION 308
Method two is enabled, the editing interface definition files
Ribbon XML serialization, CMFCRibbonConstructor and CMFCRibbonInfo also provides full feature support, not only is the editor provides editing functions, then we can enable it by Ribbon resource definition file editor behind in
Find solutions Explorer ribbon.mfcribbon-ms file, open it, it is an XML format file, but all of the contents of only one line, press Ctrl + K, F can be formatted wrap in Visual Studio, and then find Panel elements corresponding node
<PANELS>
<PANEL>
<ELEMENT_NAME>Panel</ELEMENT_NAME>
<NAME>剪贴板</NAME>
<KEYS>D</KEYS>
<INDEX>1</INDEX>
<JUSTIFY_COLUMNS>FALSE</JUSTIFY_COLUMNS>
<CENTER_COLUMN_VERT>FALSE</CENTER_COLUMN_VERT>
<ELEMENTS>
...
</ELEMENTS>
<PANELS>
Increase BUTTON_LAUNCH element
<PANELS>
<PANEL>
<ELEMENT_NAME>Panel</ELEMENT_NAME>
<NAME>剪贴板</NAME>
<KEYS>D</KEYS>
<INDEX>1</INDEX>
<JUSTIFY_COLUMNS>FALSE</JUSTIFY_COLUMNS>
<CENTER_COLUMN_VERT>FALSE</CENTER_COLUMN_VERT>
<ELEMENTS>
...
</ELEMENTS>
<BUTTON_LAUNCH>
<ELEMENT_NAME>Button_Launch</ELEMENT_NAME>
<ID>
<NAME>ID_VIEW_OPTION</NAME>
<VALUE>308</VALUE>
</ID>
<KEYS>S</KEYS>
</BUTTON_LAUNCH>
<PANELS>
The same must be defined ID_VIEW_OPTION in resource.h, the value must be in the XML node values as VALUE
// 在 Resource.h 中
#define ID_VIEW_OPTION 308
How to respond to button events
And in general the same button, use the class wizard to add the line