Muokkaa

Jaa


CMFCToolBarImages Class

The images on a toolbar. The CMFCToolBarImages class manages toolbar images loaded from application resources or from files. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

Syntax

class CMFCToolBarImages : public CObject

Members

Public Constructors

Name Description
CMFCToolBarImages::CMFCToolBarImages Constructs a CMFCToolBarImages object.

Public Methods

Name Description
CMFCToolBarImages::AdaptColors
CMFCToolBarImages::AddIcon Adds an icon to the toolbar images.
CMFCToolBarImages::AddImage Adds a bitmap to the toolbar images.
CMFCToolBarImages::CleanUp
CMFCToolBarImages::Clear Frees the system resources that were allocated to this object.
CMFCToolBarImages::ConvertTo32Bits Converts underlined bitmaps to 32 bpp images.
CMFCToolBarImages::CopyImageToClipboard
CMFCToolBarImages::CopyTo
CMFCToolBarImages::CreateFromImageList Initializes the toolbar images from an image list ( CImageList Class).
CMFCToolBarImages::CreateRegionFromImage
CMFCToolBarImages::DeleteImage Deletes the image that has a specified index from the toolbar images if this set of toolbar images contains user-defined images.
CMFCToolBarImages::Draw Draws a single toolbar image (button).
CMFCToolBarImages::DrawEx
CMFCToolBarImages::EnableRTL
CMFCToolBarImages::EndDrawImage Frees system resources after a toolbar image is drawn.
CMFCToolBarImages::ExtractIcon Returns the icon that has a specified image index from the toolbar images.
CMFCToolBarImages::FillDitheredRect Fills a rectangle by using a brush that has the toolbar background colors.
CMFCToolBarImages::GetAlwaysLight
CMFCToolBarImages::GetBitsPerPixel Returns current resolution of underlined images.
CMFCToolBarImages::GetCount Returns the number of images on the toolbar.
CMFCToolBarImages::GetDisabledImageAlpha Returns the alpha channel value that is used for disabled images.
CMFCToolBarImages::GetFadedImageAlpha
CMFCToolBarImages::GetImageSize Retrieves either the size of the toolbar images that are stored in memory (source size), or the size of the toolbar images that are drawn on the screen (destination size).
CMFCToolBarImages::GetImageWell Returns the handle to the bitmap that contains all the toolbar images.
CMFCToolBarImages::GetImageWellLight
CMFCToolBarImages::GetLastImageRect
CMFCToolBarImages::GetLightPercentage
CMFCToolBarImages::GetMapTo3DColors
CMFCToolBarImages::GetMask
CMFCToolBarImages::GetResourceOffset Returns the image index for a specified resource ID.
CMFCToolBarImages::GetScale Returns current scale ratio of underlined images.
CMFCToolBarImages::GetTransparentColor
CMFCToolBarImages::GrayImages Grays the toolbar images to make them look disabled.
CMFCToolBarImages::Is32BitTransparencySupported Determines whether the operating system supports 32-bit alpha blending.
CMFCToolBarImages::IsPreMultiplyAutoCheck
CMFCToolBarImages::IsRTL Determines whether right-to-left (RTL) support is enabled.
CMFCToolBarImages::IsReadOnly Determines whether the toolbar images are read-only.
CMFCToolBarImages::IsScaled Tells whether the underlined images are scaled or not.
CMFCToolBarImages::IsUserImagesList Determines whether this set of toolbar images contains user-defined images.
CMFCToolBarImages::IsValid Determines whether this set of toolbar images contains a valid toolbar image.
CMFCToolBarImages::Load Loads toolbar images from system resources or from a file.
CMFCToolBarImages::LoadStr
CMFCToolBarImages::MapFromSysColor
CMFCToolBarImages::MapTo3dColors
CMFCToolBarImages::MapToSysColor
CMFCToolBarImages::MapToSysColorAlpha
CMFCToolBarImages::Mirror Horizontally mirrors all of the toolbar images.
CMFCToolBarImages::MirrorBitmap Horizontally mirrors a bitmap.
CMFCToolBarImages::MirrorBitmapVert
CMFCToolBarImages::MirrorVert
CMFCToolBarImages::OnSysColorChange
CMFCToolBarImages::PrepareDrawImage Allocates the resources that are required to draw a toolbar image at a specified size.
CMFCToolBarImages::Save Stores the toolbar images in a file if this set of toolbar images contains user-defined images.
CMFCToolBarImages::SetAlwaysLight
CMFCToolBarImages::SetDisabledImageAlpha Sets the alpha channel value that is used for disabled images.
CMFCToolBarImages::SetFadedImageAlpha
CMFCToolBarImages::SetImageSize Sets the size of a toolbar image (source size).
CMFCToolBarImages::SetLightPercentage
CMFCToolBarImages::SetMapTo3DColors
CMFCToolBarImages::SetPreMultiplyAutoCheck
CMFCToolBarImages::SetSingleImage
CMFCToolBarImages::SetTransparentColor Sets the transparent color of the toolbar images.
CMFCToolBarImages::SmoothResize Smoothly resizes underlined images.
CMFCToolBarImages::UpdateImage Updates a user-defined toolbar image from a bitmap.

Protected Methods

Name Description
CMFCToolBarImages::PreMultiplyAlpha

Data Members

Name Description
CMFCToolBarImages::m_bDisableTrueColorAlpha TRUE if truecolor alpha blending (32-bit color) is disabled.

Remarks

The full bitmap of toolbar images managed by CMFCToolbarImages consists of one or more small toolbar images (buttons) of a fixed size.

Example

The following example demonstrates how to configure a CMFCToolBarImages object by using various methods in the CMFCToolBarImages class. The example shows how to set the size of the toolbar image, load an image, and set the transparent color of the image. This code snippet is part of the Visual Studio Demo sample.

CMFCToolBarImages m_Image;
m_Image.SetImageSize(CSize(32, 32));
m_Image.Load(IDR_START);
m_Image.SetTransparentColor(RGB(255, 0, 255));

Inheritance Hierarchy

CObject

CMFCToolBarImages

Requirements

Header: afxtoolbarimages.h

CMFCToolBarImages::AdaptColors

void AdaptColors(
    COLORREF clrBase,
    COLORREF clrTone);

Parameters

[in] clrBase
[in] clrTone

Remarks

CMFCToolBarImages::AddIcon

Adds an icon to the list of toolbar images.

int AddIcon(
    HICON hIcon,
    BOOL bAlphaBlend=FALSE);

Parameters

hIcon
[in] A handle to the icon to be added.

bAlphaBlend
[in] TRUE if this icon is used with alpha blending; otherwise FALSE.

Return Value

The zero-based index of the toolbar image that was added if the method is successful; otherwise -1.

CMFCToolBarImages::AddImage

Adds a bitmap to the toolbar images.

int AddImage(
    HBITMAP hbmp,
    BOOL bSetBitPerPixel=FALSE);

int AddImage(
    const CMFCToolBarImages& imageList,
    int nIndex);

Parameters

hbmp
[in] The handle to the bitmap to add.

bSetBitPerPixel
[in] TRUE if the CMFCToolBarImages object uses the color depth (bits per pixel) of the new image; FALSE if the CMFCToolbarImages object keeps the current color depth.

imageList
[in] A reference to a CMFCToolbarImages object that contains the image to add.

nIndex
[in] The index in the source CMFCToolbarImages object of the image to add.

Return Value

The number of toolbar images that the CMFCToolBarImages object maintains after the new bitmap was added successfully; -1 if the operation failed.

CMFCToolBarImages::CleanUp

static void __stdcall CleanUp();

Remarks

CMFCToolBarImages::Clear

Frees the system resources that the CMFCToolbarImages object allocated.

void Clear();

CMFCToolBarImages::CMFCToolBarImages

Constructs a CMFCToolBarImages object.

CMFCToolBarImages();

Remarks

Constructs a CMFCToolBarImages object, initializes its rendering engine and sets the image size to its default value 16x15 pixels. Use CMFCToolBarImages::SetImageSize to change the image size before you add images.

CMFCToolBarImages::CopyImageToClipboard

BOOL CopyImageToClipboard(int iImage);

Parameters

[in] iImage

Return Value

Remarks

CMFCToolBarImages::CopyTo

BOOL CopyTo(CMFCToolBarImages& imageList);

Parameters

[in] imageList

Return Value

Remarks

CMFCToolBarImages::CreateFromImageList

Initializes the toolbar images from a CImageList Class object.

BOOL CreateFromImageList(const CImageList& imageList);

Parameters

imageList
[in] The image list to be used as a source for toolbar images.

Return Value

Always returns TRUE.

Remarks

Use this function to quickly initialize the toolbar images list from an external image list.

CMFCToolBarImages::CreateRegionFromImage

static HRGN __stdcall CreateRegionFromImage(
    HBITMAP bmp,
    COLORREF clrTransparent);

Parameters

[in] bmp
[in] clrTransparent

Return Value

Remarks

CMFCToolBarImages::DeleteImage

Deletes the user-defined image that has a specified index from the toolbar images.

BOOL DeleteImage(int iImage);

Parameters

iImage
[in] Specifies the zero-based index of the image to delete.

Return Value

TRUE if the image was deleted successfully; FALSE if the image index is invalid, the CMFCToolbarImages object is temporary, the CMFCToolbarImages object does not contain user-defined images, or if some other error occurred.

CMFCToolBarImages::Draw

Draws a single toolbar image.

BOOL Draw(
    CDC* pDC,
    int x,
    int y,
    int iImageIndex,
    BOOL bHilite=FALSE,
    BOOL bDisabled=FALSE,
    BOOL bIndeterminate=FALSE,
    BOOL bShadow=FALSE,
    BOOL bInactive=FALSE,
    BYTE alphaSrc=255);

Parameters

pDC
[in] A pointer to a device context.

x
[in] The X coordinate of the left side of the rectangle where the image is to be drawn.

y
[in] The Y coordinate of the top of the rectangle where the image is to be drawn.

iImageIndex
[in] The zero-based index of the image to be displayed.

bHilite
[in] TRUE if the image is to be highlighted; otherwise FALSE.

bDisabled
[in] TRUE if the image is to be drawn in the disabled style; otherwise FALSE.

bIndeterminate
[in] TRUE if the image is to be drawn in the indeterminate state style; otherwise FALSE.

bShadow
[in] TRUE if the image is to be drawn with a drop shadow; otherwise FALSE.

bInactive
[in] TRUE if the image is to be drawn in the inactive state style; otherwise FALSE.

alphaSrc
[in] The alpha channel (opacity) value. A value of 255 means the image is drawn opaque. A value of 0 means the image is drawn transparent. This value is used only for 32 bit color images and for images that displayed a Windows Vista glass style.

Return Value

TRUE if the specified image was displayed successfully; FALSE if the image index was invalid or some other error occurred.

CMFCToolBarImages::DrawEx

BOOL DrawEx(
    CDC* pDC,
    CRect rect,
    int iImageIndex,
    ImageAlignHorz horzAlign = ImageAlignHorzLeft,
    ImageAlignVert vertAlign = ImageAlignVertTop,
    CRect rectSrc = CRect(0, 0, 0, 0),
    BYTE alphaSrc = 255);

Parameters

[in] pDC
[in] rect
[in] iImageIndex
[in] horzAlign
[in] vertAlign
[in] rectSrc
[in] alphaSrc

Return Value

Remarks

CMFCToolBarImages::EnableRTL

static void __stdcall EnableRTL(BOOL bIsRTL = TRUE);

Parameters

[in] bIsRTL

Remarks

CMFCToolBarImages::EndDrawImage

Frees system resources that CMFCToolBarImages::PrepareDrawImage allocated after you draw a toolbar image by calling CMFCToolBarImages::Draw.

void EndDrawImage(CAfxDrawState& ds);

Parameters

ds
[in] A reference to the CAfxDrawState object that was passed to the PrepareDrawImage method.

CMFCToolBarImages::ExtractIcon

Returns the icon that has a specified image index from the toolbar images.

HICON ExtractIcon(int nIndex);

Parameters

nIndex
[in] The zero-based index in the image list at which the image to be extracted as an icon is located.

Return Value

A handle to the extracted icon, or NULL if nIndex is out of range.

CMFCToolBarImages::FillDitheredRect

Fills a rectangle with the toolbar background colors.

static void FillDitheredRect(
    CDC* pDC,
    const CRect& rect);

Parameters

pDC
[in] A pointer to a device context.

rect
[in] The coordinates of a rectangle to fill.

Remarks

Use this method to fill a rectangle with a color that is the average of the system colors COLOR_BTNFACE and COLOR_BTNHIGHLIGHT. If the system is using 256 or fewer colors, the rectangle will be filled with a dithered pattern of those two colors instead.

CMFCToolBarImages::GetAlwaysLight

BOOL GetAlwaysLight() const;

Return Value

Remarks

CMFCToolBarImages::GetCount

Returns the number of images in the toolbar images list.

int GetCount() const;

Return Value

The number of images in the CMFCToolBarImages object.

CMFCToolBarImages::GetDisabledImageAlpha

Returns the alpha channel (opacity) value that is used for disabled images.

static BYTE GetDisabledImageAlpha();

Return Value

The current alpha channel value.

Remarks

You can call CMFCToolBarImages::SetDisabledImageAlpha to change the alpha channel value.

CMFCToolBarImages::GetFadedImageAlpha

static BYTE __stdcall GetFadedImageAlpha();

Return Value

Remarks

CMFCToolBarImages::GetImageSize

Retrieves either the size of the toolbar images that are stored in memory (source size), or the size of the toolbar images that are drawn on the screen (destination size).

SIZE GetImageSize(BOOL bDest=FALSE) const;

Parameters

bDest
[in] TRUE to retrieve the destination size; FALSE to retrieve the source image size.

Return Value

A SIZE structure, which specifies the size of an image in pixels.

Remarks

The size of the source image is the size of the images that are stored in the CMFCToolbarImages object. You can call CMFCToolBarImages::SetImageSize to set the source size. The default value is 16x15 pixels.

By default, the destination image size is 0x0. You specify the destination size when you call CMFCToolBarImages::PrepareDrawImage. The CMFCToolBarImages::EndDrawImage method resets the destination size to the default value.

CMFCToolBarImages::GetImageWell

Returns the handle to the bitmap that contains all the toolbar images.

HBITMAP GetImageWell() const;

Return Value

A handle to a bitmap that contains toolbar images.

Remarks

The toolbar images are stored in a row in a single bitmap that is known as an image well. To find a toolbar image in the image well, multiply the index of the image by the width of the toolbar images (see CMFCToolBarImages::GetImageSize) to obtain the horizontal offset of the image inside the image well.

CMFCToolBarImages::GetImageWellLight

HBITMAP GetImageWellLight() const;

Return Value

Remarks

CMFCToolBarImages::GetLastImageRect

CRect GetLastImageRect() const;

Return Value

Remarks

CMFCToolBarImages::GetLightPercentage

int GetLightPercentage() const;

Return Value

Remarks

CMFCToolBarImages::GetMapTo3DColors

BOOL GetMapTo3DColors() const;

Return Value

Remarks

CMFCToolBarImages::GetMask

HBITMAP GetMask(int iImage);

Parameters

[in] iImage

Return Value

Remarks

CMFCToolBarImages::GetResourceOffset

Returns the image index for a specified resource ID.

int GetResourceOffset(UINT uiResId) const;

Parameters

uiResId
[in] An image resource ID.

Return Value

An image index if the method was successful; -1 if the image with the specified resource ID does not exist.

CMFCToolBarImages::GetTransparentColor

COLORREF GetTransparentColor() const;

Return Value

Remarks

CMFCToolBarImages::GrayImages

Grays the toolbar images to make them look disabled.

BOOL GrayImages(int nGrayImageLuminancePercentage);

Parameters

nGrayImageLuminancePercentage
[in] 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.

CMFCToolBarImages::Is32BitTransparencySupported

Specifies whether the operating system supports 32-bit alpha blending.

static BOOL Is32BitTransparencySupported();

Return Value

TRUE if 32-bit alpha blending is supported; otherwise FALSE.

Remarks

Use this static method to determine at runtime whether the operating system supports 32-bit alpha blending. This feature is supported on Windows 2000 and later versions.

CMFCToolBarImages::IsPreMultiplyAutoCheck

BOOL IsPreMultiplyAutoCheck() const;

Return Value

Remarks

CMFCToolBarImages::IsReadOnly

Specifies whether the toolbar images are read-only.

BOOL IsReadOnly() const;

Return Value

TRUE if the toolbar images are read-only, otherwise FALSE.

Remarks

The CMFCToolbarImages object is read-only when the bitmap with toolbar images was loaded from a read-only file, or when the bitmap was copied in using the CMFCToolBarImages::CopyTemp method.

CMFCToolBarImages::IsRTL

Specifies whether right-to-left (RTL) support is enabled.

static BOOL IsRTL();

Return Value

TRUE if RTL support is enabled; otherwise FALSE.

Remarks

RTL support is used when the application is localized to a language that is read from right to left, such as Arabic, Hebrew, Persian, or Urdu.

CMFCToolBarImages::IsUserImagesList

Specifies whether this set of toolbar images contains user-defined images.

BOOL IsUserImagesList() const;

Return Value

TRUE if the CMFCToolBarImages object contains user-defined toolbar images; otherwise FALSE.

CMFCToolBarImages::IsValid

Indicates whether this set of toolbar images contains a valid toolbar image.

BOOL IsValid() const;

Return Value

TRUE if a CMFCToolBarImages object is valid; otherwise FALSE.

Remarks

The CMFCToolBarImages object is not valid when its handle to a bitmap with toolbar images is NULL.

CMFCToolBarImages::Load

Loads toolbar images from system resources or from a file.

BOOL Load(
    UINT uiResID,
    HINSTANCE hinstRes=NULL,
    BOOL bAdd=FALSE);

BOOL Load(
    LPCTSTR lpszBmpFileName,
    DWORD nMaxFileSize = 819200);

Parameters

uiResID
[in] The ID of a bitmap resource.

hinstRes
[in] An instance of the resource DLL.

bAdd
[in] TRUE to add the loaded bitmap to the existing bitmap, or FALSE to replace the existing bitmap.

lpszBmpFileName
[in] A path to a disk file from which to load the bitmap.

nMaxFileSize
[in] Maximum number of bytes in the bitmap file; or 0 to load the bitmap regardless of file size. If the size of the file exceeds this maximum size, the method returns FALSE and does not load the bitmap.

Return Value

TRUE if the bitmap was loaded successfully; otherwise FALSE.

Remarks

If the file has the read-only attribute, the image list is marked as read-only.

CMFCToolBarImages::LoadStr

BOOL LoadStr(
    LPCTSTR lpszResourceName,
    HINSTANCE hinstRes = NULL,
    BOOL bAdd = FALSE);

Parameters

[in] lpszResourceName
[in] hinstRes
[in] bAdd

Return Value

Remarks

CMFCToolBarImages::MapFromSysColor

static COLORREF __stdcall MapFromSysColor(
    COLORREF color,
    BOOL bUseRGBQUAD = TRUE);

Parameters

[in] color
[in] bUseRGBQUAD

Return Value

Remarks

CMFCToolBarImages::MapTo3dColors

BOOL MapTo3dColors(
    BOOL bUseRGBQUAD = TRUE,
    COLORREF clrSrc = (COLORREF)-1,
    COLORREF clrDest = (COLORREF)-1);

Parameters

[in] bUseRGBQUAD
[in] clrSrc
[in] clrDest

Return Value

Remarks

CMFCToolBarImages::MapToSysColor

static COLORREF __stdcall MapToSysColor(
    COLORREF color,
    BOOL bUseRGBQUAD = TRUE);

Parameters

[in] color
[in] bUseRGBQUAD

Return Value

Remarks

CMFCToolBarImages::MapToSysColorAlpha

static COLORREF __stdcall MapToSysColorAlpha(COLORREF color);

Parameters

[in] color

Return Value

Remarks

CMFCToolBarImages::Mirror

Replaces the toolbar images with their horizontal mirror image.

BOOL Mirror();

Return Value

TRUE if the images were successfully mirrored; otherwise FALSE.

Remarks

This method is used to support right-to-left writing systems.

CMFCToolBarImages::MirrorBitmap

Replaces a bitmap with its horizontal mirror image.

static BOOL MirrorBitmap(
    HBITMAP& hbmp,
    int cxImage);

Parameters

hbmp
[in, out] A handle to bitmap to mirror.

cxImage
[in] Width of the image in pixels.

Return Value

TRUE if the image was successfully mirrored; otherwise FALSE.

Remarks

This function is used to support right-to-left writing systems.

CMFCToolBarImages::MirrorBitmapVert

static BOOL __stdcall MirrorBitmapVert(
    HBITMAP& hbmp,
    int cyImage);

Parameters

[in] hbmp
[in] cyImage

Return Value

Remarks

CMFCToolBarImages::MirrorVert

BOOL MirrorVert();

Return Value

Remarks

CMFCToolBarImages::OnSysColorChange

void OnSysColorChange();

Remarks

CMFCToolBarImages::PreMultiplyAlpha

static BOOL __stdcall PreMultiplyAlpha(
    HBITMAP hbmp,
    BOOL bAutoCheckPremlt);

BOOL PreMultiplyAlpha(HBITMAP hbmp);

Parameters

[in] hbmp
[in] bAutoCheckPremlt

Return Value

Remarks

CMFCToolBarImages::m_bDisableTrueColorAlpha

TRUE if truecolor alpha blending (32-bit color) is disabled.

static BOOL m_bDisableTrueColorAlpha;

Remarks

Set this member variable to FALSE to enable truecolor alpha-blending for toolbar images.

The default value is TRUE for backward compatibility.

CMFCToolBarImages::PrepareDrawImage

Allocates the resources that are required to draw a toolbar image at a specified size.

BOOL PrepareDrawImage(
    CAfxDrawState& ds,
    CSize sizeImageDest=CSize(0,
    0)
    BOOL bFadeInactive=FALSE);

Parameters

ds
[in] A reference to CAfxDrawState structure, which stores the allocated resources between image rendering stages.

sizeImageDest
[in] Specifies the size of a destination image.

bFadeInactive
[in] TRUE if you want inactive images to be drawn faded.

Return Value

TRUE if the resources required to draw the toolbar image were allocated successfully, otherwise FALSE.

Remarks

After you call this method, you can call CMFCToolBarImages::Draw any number of times. After you finished drawing, you must call CMFCToolBarImages::EndDrawImage to release the resources allocated by PrepareDrawImage.

CMFCToolBarImages::Save

Stores the toolbar images in a file if this set of toolbar images contains user-defined images.

BOOL Save(LPCTSTR lpszBmpFileName=NULL);

Parameters

lpszBmpFileName
A path to a disk file.

Return Value

TRUE if the toolbar images were saved successfully; otherwise FALSE.

Remarks

Call this method to store the user-defined images into a disk file. If lpszBmpFileName is NULL, the method stores the bitmap into the file from which the bitmap was loaded by the CMFCToolBarImages::Load method.

CMFCToolBarImages::SetAlwaysLight

void SetAlwaysLight(BOOL bAlwaysLight = TRUE);

Parameters

[in] bAlwaysLight

Remarks

CMFCToolBarImages::SetDisabledImageAlpha

Sets the alpha channel (opacity) value that is used for disabled images.

static void SetDisabledImageAlpha(BYTE nValue);

Parameters

nValue
[in] The new value of the alpha channel.

Remarks

Use this method to set a custom alpha value for disabled images. The default value is 127, which causes disabled button images to be semitransparent. If you set a value of 0, disabled images will be completely transparent. If you set a value of 255, disabled images will be completely opaque.

CMFCToolBarImages::SetFadedImageAlpha

static void __stdcall SetFadedImageAlpha(BYTE nValue);

Parameters

[in] nValue

Remarks

CMFCToolBarImages::SetImageSize

Sets the size of each toolbar image (source size).

void SetImageSize(
    SIZE sizeImage,
    BOOL bUpdateCount=FALSE);

Parameters

sizeImage
[in] The new size of toolbar images.

Remarks

By default the size of the toolbar image is 16x15 pixels. Call this method if you want to use toolbar images of a different size.

CMFCToolBarImages::SetLightPercentage

void SetLightPercentage(int nValue);

Parameters

[in] nValue

Remarks

CMFCToolBarImages::SetMapTo3DColors

void SetMapTo3DColors(BOOL bMapTo3DColors);

Parameters

[in] bMapTo3DColors

Remarks

CMFCToolBarImages::SetPreMultiplyAutoCheck

void SetPreMultiplyAutoCheck(BOOL bAuto = TRUE);

Parameters

[in] bAuto

Remarks

CMFCToolBarImages::SetSingleImage

void SetSingleImage();

Remarks

CMFCToolBarImages::SetTransparentColor

Sets the transparent color of the toolbar images.

COLORREF SetTransparentColor(COLORREF clrTransparent);

Parameters

clrTransparent
[in] An RGB value.

Return Value

The previous transparent color.

Remarks

When you or the framework call CMFCToolBarImages::Draw, the method does not draw any pixel that matches the color specified by clrTransparent.

CMFCToolBarImages::UpdateImage

Updates a user-defined toolbar image from a bitmap.

BOOL UpdateImage(
    int iImage,
    HBITMAP hbmp);

Parameters

iImage
[in] The zero-based index of the image to update.

hbmp
[in] A handle to the bitmap from which to update the image.

Return Value

TRUE if the image was updated successfully; FALSE if the image list is not user-defined or temporary.

CMFCToolBarImages::ConvertTo32Bits

Converts underlined bitmaps to 32 bpp images.

BOOL ConvertTo32Bits(COLORREF clrTransparent = (COLORREF)-1);

Parameters

clrTransparent
Specifies transparent color of underlined bitmaps.

Remarks

CMFCToolBarImages::GetBitsPerPixel

Returns current resolution of underlined images.

int GetBitsPerPixel() const;

Return Value

An integer value representing the current resolution of underlined images, in bits per pixel (bpp).

Remarks

CMFCToolBarImages::GetScale

Returns the current scale ratio of underlined images.

double GetScale() const;

Return Value

A value representing the current scale ratio.

Remarks

CMFCToolBarImages::IsScaled

Tells whether the underlined images are scaled or not.

BOOL IsScaled () const;

Return Value

TRUE if underlined images are scaled; otherwise FALSE.

Remarks

CMFCToolBarImages::SmoothResize

Smoothly resizes underlined images.

BOOL SmoothResize(double dblImageScale);

Parameters

dblImageScale
Scale ratio.

Return Value

TRUE if resize succeeds; otherwise FALSE.

Remarks

See also

Hierarchy Chart
Classes
CObject Class
CMFCToolBar Class
CMFCToolBarButton Class