共用方式為


CMFCRibbonButton::CMFCRibbonButton

Constructs a ribbon button object.

CMFCRibbonButton(
   UINT nID,
   LPCTSTR lpszText,
   int nSmallImageIndex=-1,
   int nLargeImageIndex=-1,
   BOOL bAlwaysShowDescription=FALSE 
);
CMFCRibbonButton(
   UINT nID,
   LPCTSTR lpszText,
   HICON hIcon,
   BOOL bAlwaysShowDescription=FALSE,
   HICON hIconSmall=NULL,
   BOOL bAutoDestroyIcon=FALSE,
   BOOL bAlphaBlendIcon=FALSE 
);

Parameters

  • [in] nID
    Specifies the command ID of the button.

  • [in] lpszText
    Specifies the text label of the button.

  • [in] nSmallImageIndex
    Specifies a zero-based index of the button's small image in the image list of the parent category.

  • [in] nLargeImageIndex
    Specifies a zero-based index of the button's large image in the image list of the parent category.

  • [in] hIcon
    Specifies a handle to the icon that the application uses as the button's image.

Example

The following example demonstrates how to construct a CMFCRibbonButton object.

    strTemp.LoadString(IDS_RIBBON_CUT);
    CMFCRibbonButton* butn = new CMFCRibbonButton(ID_EDIT_CUT, strTemp, 1);
    butn ->SetKeys(_T("k"));

Requirements

Header: afxribbonbutton.h

See Also

Reference

CMFCRibbonButton Class

Hierarchy Chart