共用方式為


CMFCToolBar::SetButtons

Sets the buttons for the toolbar.

virtual BOOL SetButtons(
   const UINT* lpIDArray,
   int nIDCount,
   BOOL bRemapImages=TRUE 
);

Parameters

  • [in] lpIDArray
    A pointer to the array of command IDs of the buttons to insert.

  • [in] nIDCount
    The number of items in lpIDArray.

  • [in] bRemapImages
    A Boolean value that specifies whether to associate the existing button images with the inserted buttons. If this parameter is TRUE, the images are remapped.

Return Value

Nonzero if the method succeeds; otherwise 0.

Remarks

Call this method to remove existing buttons from a toolbar and insert a collection of new buttons.

This method adds the Customize button to the toolbar and sends the AFX_WM_RESETTOOLBAR message to the parent window of the toolbar. For more information about the Customize button, see CMFCToolBar::EnableCustomizeButton.

Requirements

Header: afxtoolbar.h

See Also

Reference

CMFCToolBar Class

Hierarchy Chart

CMFCToolBar::EnableCustomizeButton