Share via


CToolBarCtrl::ChangeBitmap

Changes the bitmap for a button in the current toolbar control.

BOOL ChangeBitmap(
     int idButton, 
     int iBitmap
);

Parameters

Parameter

Description

[in] idButton

Command identifier of the button that is to receive a new bitmap.

[in] iBitmap

Zero-based index of an image in the current toolbar control's image list.

Return Value

true if this method is successful; otherwise, false.

Remarks

If this method is successful, the system displays the specified image in the specified button.

This method sends the TB_CHANGEBITMAP message, which is described in the Windows SDK.

Requirements

Header: afxcmn.h

Example

The following code example changes the bitmap for the File Save button to the bitmap for the About button.

    {
        // Change the bitmap for the File Save button, whose 
        // command ID is ID_FILE_SAVE, to the bitmap for the 
        // About button, whose index is 7. 
        CToolBarCtrl& m_toolBarCtrl = m_wndToolBar.GetToolBarCtrl();
        BOOL bRet = m_toolBarCtrl.ChangeBitmap( ID_FILE_SAVE, 7 );
    }

See Also

Reference

CToolBarCtrl Class

Hierarchy Chart

TB_CHANGEBITMAP

CToolBarCtrl::ReplaceBitmap

Other Resources

CToolBarCtrl Members