共用方式為


CMFCToolBar::SetButtonInfo

Sets the command ID, style, and image ID of a toolbar button.

void SetButtonInfo(
   int nIndex,
   UINT nID,
   UINT nStyle,
   int iImage 
);

Parameters

  • [in] nIndex
    The zero-based index of the button whose properties are set.

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

  • [in] nStyle
    The style of the button. See ToolBar Control Styles for the list of available toolbar button styles.

  • [in] iImage
    The zero-based image index of the button (that is, the index in the collection of toolbar images).

Remarks

Call this method to set the properties of a toolbar button.

In Debug builds, this method generates an assertion failure if the index that is specified by nIndex is invalid.

Call the CMFCToolBar::SetButtonStyle method to set only the style of the button.

Requirements

Header: afxtoolbar.h

See Also

Reference

CMFCToolBar Class

Hierarchy Chart

ToolBar Control Styles

CMFCToolBar::SetButtonStyle