共用方式為


CMFCRibbonButton::SetMenu

Assigns a pop-up menu to the ribbon button.

void SetMenu(
   HMENU hMenu,
   BOOL bIsDefaultCommand=FALSE,
   BOOL bRightAlign=FALSE 
);
void SetMenu(
   UINT uiMenuResID,
   BOOL bIsDefaultCommand=FALSE,
   BOOL bRightAlign=FALSE 
);

Parameters

  • hMenu
    A handle to a Windows menu.

  • bIsDefaultCommand
    If TRUE, the button can execute its default command; otherwise, the button displays a pop-up menu.

  • bRightAlign
    If TRUE, the menu is right-aligned. Otherwise, the menu is left-aligned.

  • uiMenuResID
    A menu resource ID.

Remarks

When the application assigns the menu to the button, the button displays an arrow on its right side. If bIsDefaultCommand is TRUE, the menu appears only when the user clicks the arrow. If the user clicks the button, its default command is executed. If bIsDefaultCommand is FALSE, the menu appears by clicking anywhere on the button.

Requirements

Header: afxribbonbutton.h

See Also

Reference

CMFCRibbonButton Class

Hierarchy Chart