다음을 통해 공유


CToolBar::SetButtons

This member function sets each toolbar button's command ID to the value specified by the corresponding element of the array lpIDArray.

BOOL SetButtons( 
   const UINT* lpIDArray, 
   int nIDCount  
);

Parameters

  • lpIDArray
    Pointer to an array of command Ids. It can be NULL to allocate empty buttons.

  • nIDCount
    Number of elements in the array pointed to by lpIDArray.

Return Value

Nonzero if successful; otherwise 0.

Remarks

If an element of the array has the value ID_SEPARATOR, a separator is created in the corresponding position of the toolbar. This function also sets each button's style to TBBS_BUTTON and each separator's style to TBBS_SEPARATOR, and assigns an image index to each button. The image index specifies the position of the button's image within the bitmap.

You do not need to account for separators in the bitmap because this function does not assign image indexes for separators. If your toolbar has buttons at positions 0, 1, and 3 and a separator at position 2, the images at positions 0, 1, and 2 in your bitmap are assigned to the buttons at positions 0, 1, and 3, respectively.

If lpIDArray is NULL, this function allocates space for the number of items specified by nIDCount. Use SetButtonInfo to set each item's attributes.

Requirements

Header: afxext.h

See Also

Reference

CToolBar Class

Hierarchy Chart

CToolBar::Create

CToolBar::SetButtonInfo

CToolBar::SetButtonStyle

CToolBar::LoadToolBar