Share via


CToolBarCtrl::AddBitmap

Adds one or more button images to the list of button images stored in the toolbar control.

int AddBitmap(
   int nNumButtons,
   UINT nBitmapID 
);
int AddBitmap(
   int nNumButtons,
   CBitmap* pBitmap 
);

Parameters

  • nNumButtons
    Number of button images in the bitmap.

  • nBitmapID
    Resource identifier of the bitmap that contains the button image or images to add.

  • pBitmap
    Pointer to the CBitmap object that contains the button image or images to add.

Return Value

Zero-based index of the first new image if successful; otherwise – 1.

Remarks

You can use the Windows API CreateMappedBitmap to map colors before adding the bitmap to the toolbar. If you pass a pointer to a CBitMap object, you must ensure that the bitmap is not destroyed until after the toolbar is destroyed.

Requirements

Header: afxcmn.h

See Also

Reference

CToolBarCtrl Class

Hierarchy Chart

CToolBarCtrl::AddButtons

CToolBarCtrl::InsertButton

CToolBarCtrl::AddString

CToolBarCtrl::AddStrings

Other Resources

CToolBarCtrl Members