共用方式為


CMFCToolBarImages::GrayImages

Grays the toolbar images to make them look disabled.

BOOL GrayImages(
   int nGrayImageLuminancePercentage 
);

Parameters

  • [in] nGrayImageLuminancePercentage
    Luminance percentage.

Return Value

TRUE if images in the collection were grayed successfully; otherwise FALSE.

Remarks

This method modifies the toolbar images by averaging the red, green, and blue components of each pixel and multiplying the result by nGrayImageLuminancePercentage divided by 100. If nGrayImageLuminancePercentage is zero or negative, the default value of 130 is used instead.

Note

If you want to undo the change, you must reload the images from the source. You can do this by calling CMFCToolBarImages::Load or CMFCToolBarImages::UpdateImage (only for user-defined images), or by calling CMFCToolBarImages::Clear and adding the images again by calling CMFCToolBarImages::AddIcon or CMFCToolBarImages::AddImage.

Requirements

Header: afxtoolbarimages.h

See Also

Reference

CMFCToolBarImages Class

Hierarchy Chart