共用方式為


CMFCToolBar::SetUserImages

Sets the collection of user-defined images in the application.

static BOOL SetUserImages(
   CMFCToolBarImages* pUserImages 
);

Parameters

  • [in] pUserImages
    A pointer to the collection of user-defined images.

Return Value

Nonzero if the method succeeds; otherwise 0 if the specified CMFCToolBarImages object is not valid or has an image size that differs from the default image size of the toolbar.

Remarks

The framework uses user-defined images to draw toolbar buttons that are customized by the user. The image list specified by pUserImages is shared among all toolbars in the application.

This method generates an assertion failure in Debug builds if the specified CMFCToolBarImages object is not valid or has an image size that differs from the default image size of the toolbar.

The OutlookDemo, ToolTipDemo, and VisualStudioDemo samples use this method to set the global collection of user-defined images. They load the file that is named UserImages.bmp, which is located in the working directory of the application.

Call the CMFCToolBar::GetUserImages method to retrieve the collection of user-defined images in the application.

Requirements

Header: afxtoolbar.h

See Also

Reference

CMFCToolBar Class

Hierarchy Chart

CMFCToolBarImages Class

CMFCToolBar::GetUserImages