共用方式為


CMFCToolBarsCustomizeDialog::ReplaceButton

Replaces a toolbar button in the list box of commands on the Commands page.

void ReplaceButton(
   UINT uiCmd,
   const CMFCToolBarButton& button 
);

Parameters

  • [in] uiCmd
    Specifies the command of the button to be replaced.

  • [in] button
    A const reference to the toolbar button object that replaces the old button.

Remarks

When CMFCToolBarsCustomizeDialog::AddMenu, CMFCToolBarsCustomizeDialog::AddMenuCommands, or CMFCToolBarsCustomizeDialog::AddToolBar adds a command to the Commands page, that command is in the form of a CMFCToolBarButton Class object (or a CMFCToolBarMenuButton Class object for a menu item that contains a submenu added by AddMenuCommands). The framework also calls these three methods to add commands automatically. If you want a command to be represented by a derived type instead, call ReplaceButton and pass in a button of the derived type.

Example

The following example demonstrates how to use the ReplaceButton method in the CMFCToolBarsCustomizeDialog class. This code snippet is part of the Visual Studio Demo sample.

    // CMFCToolBarsCustomizeDialog* pDlgCust
    // CMFCToolBarComboBoxButton comboButtonConfig
    pDlgCust->ReplaceButton(ID_DUMMY_SELECT_ACTIVE_CONFIGURATION, comboButtonConfig);

Requirements

Header: afxToolBarsCustomizeDialog.h

See Also

Reference

CMFCToolBarsCustomizeDialog Class

Hierarchy Chart