Compartilhar via


CToolBarCtrl::ReplaceBitmap

Replaces the existing bitmap in the current toolbar control with a new bitmap.

BOOL ReplaceBitmap(
     LPTBREPLACEBITMAP pReplaceBitmap
);

Parameters

Parameter

Description

[in] pReplaceBitmap

Pointer to a TBREPLACEBITMAP structure that describes the bitmap to be replaced and the new bitmap.

Return Value

true if this method is successful; otherwise, false.

Remarks

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

Requirements

Header: afxcmn.h

Example

The following code example replaces the bitmap for the standard toolbar with a different bitmap.

    {
        // Replace one toolbar bitmap with another.
        TBREPLACEBITMAP tbrb;
        tbrb.hInstOld = ::AfxGetInstanceHandle(); 
        tbrb.nIDOld = IDR_MAINFRAME;
        tbrb.hInstNew = ::AfxGetInstanceHandle();
        tbrb.nIDNew = IDR_MAINFRAME1; 
        tbrb.nButtons = 8;
        CToolBarCtrl& m_toolBarCtrl = m_wndToolBar.GetToolBarCtrl();
        BOOL bRet = m_toolBarCtrl.ReplaceBitmap( &tbrb );
    }

See Also

Reference

CToolBarCtrl Class

Hierarchy Chart

TB_REPLACEBITMAP

TBREPLACEBITMAP

CToolBarCtrl::ChangeBitmap

Other Resources

CToolBarCtrl Members