共用方式為


CMFCRibbonBar::SetQuickAccessCommands

Adds one or more ribbon elements to the Quick Access Toolbar.

void SetQuickAccessCommands(
   const CList<UINT,UINT>& lstCommands,
   BOOL bRecalcLayout=TRUE 
);

Parameters

  • [in] lstCommands
    The list of commands to be placed on the Quick Access Toolbar.

  • [in] bRecalcLayout
    TRUE if want to redraw the ribbon after you add the ribbon elements; FALSE otherwise.

Requirements

Header: afxribbonbar.h

Example

The following example demonstrates how to use the SetQuickAccessCommands method in the CMFCRibbonBar class.

// Add quick access commands to the toolbar
    CList<UINT, UINT> lstQATCmds;

    lstQATCmds.AddTail(ID_FILE_NEW);
    lstQATCmds.AddTail(ID_FILE_OPEN);
    lstQATCmds.AddTail(ID_FILE_SAVE);
    lstQATCmds.AddTail(ID_FILE_PRINT_DIRECT);

    // CMFCRibbonBar m_wndRibbonBar
    m_wndRibbonBar.SetQuickAccessCommands(lstQATCmds);

See Also

Reference

CMFCRibbonBar Class

Hierarchy Chart