共用方式為


CToolBarCtrl::SetPressedImageList

Sets the image list that the current toolbar control uses to represent buttons in the pressed state.

CImagelist* SetPressedImageList(
            int iImageID, 
            CImageList* pImageList
);

Parameters

Parameter

Description

[in] iImageID

The zero-based index of the image list. Set this parameter to zero if you use only one image list.

[in] pImageList

Pointer to a CImageList that contains the new image list.

Return Value

Pointer to a CImageList that contains the previous image list for the current control, or NULL if no such image list was set.

Remarks

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

Requirements

Header: afxcmn.h

This control is supported in Windows Vista and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

Example

The following code example sets the pressed image list to be the same as the default image list.

   {
        // SetPressedImageList 
        // Set the pressed image list to be the same as the  
        // normal image list.
        CToolBarCtrl& m_toolBarCtrl = m_wndToolBar.GetToolBarCtrl();
        CImageList* pNormalCil =  m_toolBarCtrl.GetImageList();
        CImageList* pPressedCil = m_toolBarCtrl.GetPressedImageList();
        m_toolBarCtrl.SetPressedImageList( 0, pNormalCil );
    }

See Also

Reference

CToolBarCtrl Class

Hierarchy Chart

TB_SETPRESSEDIMAGELIST

CImageList

CToolBarCtrl::GetPressedImageList