Share via


CMFCToolBarImages 类

工具栏上的图像。 CMFCToolBarImages 类管理从应用程序资源或文件中加载的工具栏图像。 有关详细信息,请参阅所安装的 Visual Studio 的 C\atlmfc\src\mfc 文件夹中的源代码。

语法

class CMFCToolBarImages : public CObject

成员

公共构造函数

名称 描述
CMFCToolBarImages::CMFCToolBarImages 构造 CMFCToolBarImages 对象。

公共方法

名称 描述
CMFCToolBarImages::AdaptColors
CMFCToolBarImages::AddIcon 向工具栏图像添加图标。
CMFCToolBarImages::AddImage 向工具栏图像添加位图。
CMFCToolBarImages::CleanUp
CMFCToolBarImages::Clear 释放分配给此对象的系统资源。
CMFCToolBarImages::ConvertTo32Bits 将带下划线的位图转换为 32 bpp 图像。
CMFCToolBarImages::CopyImageToClipboard
CMFCToolBarImages::CopyTo
CMFCToolBarImages::CreateFromImageList 从图像列表初始化工具栏图像(CImageList 类)。
CMFCToolBarImages::CreateRegionFromImage
CMFCToolBarImages::DeleteImage 如果此工具栏图像集包含用户定义的图像,则从工具栏图像中删除具有指定索引的图像。
CMFCToolBarImages::Draw 绘制单个工具栏图像(按钮)。
CMFCToolBarImages::DrawEx
CMFCToolBarImages::EnableRTL
CMFCToolBarImages::EndDrawImage 绘制工具栏图像后释放系统资源。
CMFCToolBarImages::ExtractIcon 返回工具栏图像中具有指定图像索引的图标。
CMFCToolBarImages::FillDitheredRect 使用具有工具栏背景色的画笔填充矩形。
CMFCToolBarImages::GetAlwaysLight
CMFCToolBarImages::GetBitsPerPixel 返回带下划线的图像的当前分辨率。
CMFCToolBarImages::GetCount 返回工具栏上的图像数。
CMFCToolBarImages::GetDisabledImageAlpha 返回用于已禁用图像的 alpha 通道值。
CMFCToolBarImages::GetFadedImageAlpha
CMFCToolBarImages::GetImageSize 检索存储在内存中的工具栏图像的大小(源大小),或者在屏幕上绘制的工具栏图像的大小(目标大小)。
CMFCToolBarImages::GetImageWell 返回包含所有工具栏图像的位图的句柄。
CMFCToolBarImages::GetImageWellLight
CMFCToolBarImages::GetLastImageRect
CMFCToolBarImages::GetLightPercentage
CMFCToolBarImages::GetMapTo3DColors
CMFCToolBarImages::GetMask
CMFCToolBarImages::GetResourceOffset 返回指定资源 ID 的图像索引。
CMFCToolBarImages::GetScale 返回带下划线的图像的当前缩放比率。
CMFCToolBarImages::GetTransparentColor
CMFCToolBarImages::GrayImages 将工具栏图像灰显,使其看起来已禁用。
CMFCToolBarImages::Is32BitTransparencySupported 确定操作系统是否支持 32 位 alpha 值混合处理。
CMFCToolBarImages::IsPreMultiplyAutoCheck
CMFCToolBarImages::IsRTL 确定是否启用从右到左 (RTL) 支持。
CMFCToolBarImages::IsReadOnly 确定工具栏图像是否为只读。
CMFCToolBarImages::IsScaled 指示是否缩放带下划线的图像。
CMFCToolBarImages::IsUserImagesList 确定这组工具栏图像是否包含用户定义的图像。
CMFCToolBarImages::IsValid 确定这组工具栏图像是否包含有效的工具栏图像。
CMFCToolBarImages::Load 从系统资源或文件中加载工具栏图像。
CMFCToolBarImages::LoadStr
CMFCToolBarImages::MapFromSysColor
CMFCToolBarImages::MapTo3dColors
CMFCToolBarImages::MapToSysColor
CMFCToolBarImages::MapToSysColorAlpha
CMFCToolBarImages::Mirror 水平镜像所有工具栏图像。
CMFCToolBarImages::MirrorBitmap 水平镜像位图。
CMFCToolBarImages::MirrorBitmapVert
CMFCToolBarImages::MirrorVert
CMFCToolBarImages::OnSysColorChange
CMFCToolBarImages::PrepareDrawImage 分配在指定大小下绘制工具栏图像所需的资源。
CMFCToolBarImages::Save 如果这组工具栏图像包含用户定义的图像,请将工具栏图像存储在文件中。
CMFCToolBarImages::SetAlwaysLight
CMFCToolBarImages::SetDisabledImageAlpha 设置用于已禁用图像的 alpha 通道值。
CMFCToolBarImages::SetFadedImageAlpha
CMFCToolBarImages::SetImageSize 设置工具栏图像的大小(源大小)。
CMFCToolBarImages::SetLightPercentage
CMFCToolBarImages::SetMapTo3DColors
CMFCToolBarImages::SetPreMultiplyAutoCheck
CMFCToolBarImages::SetSingleImage
CMFCToolBarImages::SetTransparentColor 设置工具栏图像的透明色。
CMFCToolBarImages::SmoothResize 平滑调整带下划线的图像的大小。
CMFCToolBarImages::UpdateImage 从位图更新用户定义的工具栏图像。

受保护方法

名称 描述
CMFCToolBarImages::PreMultiplyAlpha

数据成员

名称 描述
CMFCToolBarImages::m_bDisableTrueColorAlpha 如果禁用了 truecolor alpha 混合处理(32 位颜色),则为 TRUE。

备注

CMFCToolbarImages 管理的工具栏图像的完整位图包含一个或多个固定大小的小型工具栏图像(按钮)。

示例

以下示例演示如何使用 CMFCToolBarImages 类中的各种方法配置 CMFCToolBarImages 对象。 该示例演示如何设置工具栏图像的大小、加载图像以及设置图像的透明色。 此代码片段是 Visual Studio 演示示例的一部分。

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

继承层次结构

CObject

CMFCToolBarImages

要求

标头:afxtoolbarimages.h

CMFCToolBarImages::AdaptColors

void AdaptColors(
    COLORREF clrBase,
    COLORREF clrTone);

参数

[in] clrBase
[in] clrTone

注解

CMFCToolBarImages::AddIcon

将图标添加到工具栏图像列表中。

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

参数

hIcon
[in] 要添加的图标的句柄。

bAlphaBlend
[in] 如果此图标用于 alpha 值混合处理,则为 TRUE;否则为 FALSE。

返回值

如果方法成功,则返回添加的工具栏图像的从零开始的索引;否则返回 -1。

CMFCToolBarImages::AddImage

向工具栏图像添加位图。

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

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

参数

hbmp
[in] 要添加的位图的句柄。

bSetBitPerPixel
[in] 如果 CMFCToolBarImages 对象使用新图像的颜色深度(每像素位数),则为 TRUE;如果 CMFCToolbarImages 对象保持当前颜色深度,则为 FALSE。

imageList
[in] 对 CMFCToolbarImages 对象的引用,该对象包含要添加的图像。

nIndex
[in] 要添加的图像的源 CMFCToolbarImages 对象中的索引。

返回值

返回成功添加新位图后 CMFCToolBarImages 对象维护的工具栏图像数;如果操作失败,则返回 -1。

CMFCToolBarImages::CleanUp

static void __stdcall CleanUp();

备注

CMFCToolBarImages::Clear

释放 CMFCToolbarImages 对象分配的系统资源。

void Clear();

CMFCToolBarImages::CMFCToolBarImages

构造 CMFCToolBarImages 对象。

CMFCToolBarImages();

备注

构造 CMFCToolBarImages 对象,初始化其呈现引擎,并将图像大小设置为其默认值(16x15 像素)。 使用 CMFCToolBarImages::SetImageSize 在添加图像之前更改图像大小。

CMFCToolBarImages::CopyImageToClipboard

BOOL CopyImageToClipboard(int iImage);

参数

[in] iImage

返回值

备注

CMFCToolBarImages::CopyTo

BOOL CopyTo(CMFCToolBarImages& imageList);

参数

[in] imageList

返回值

注解

CMFCToolBarImages::CreateFromImageList

CImageList 类对象初始化工具栏图像。

BOOL CreateFromImageList(const CImageList& imageList);

参数

imageList
[in] 要用作工具栏图像的源的图像列表。

返回值

始终返回 TRUE。

注解

使用此函数可从外部图像列表中快速初始化工具栏图像列表。

CMFCToolBarImages::CreateRegionFromImage

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

参数

[in] bmp
[in] clrTransparent

返回值

备注

CMFCToolBarImages::DeleteImage

从工具栏图像中删除具有指定索引的用户定义的图像。

BOOL DeleteImage(int iImage);

参数

iImage
[in] 指定要删除的图像的从零开始的索引。

返回值

如果已成功删除图像,则为 TRUE;如果图像索引无效,CMFCToolbarImages 对象是临时的,CMFCToolbarImages 对象不包含用户定义的图像,或者发生其他错误,则为 FALSE。

CMFCToolBarImages::Draw

绘制单个工具栏图像。

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);

参数

pDC
[in] 指向设备上下文的指针。

x
[in] 要在其中绘制图像的矩形左侧的 X 坐标。

y
[in] 要在其中绘制图像的矩形顶部的 Y 坐标。

iImageIndex
[in] 要显示的图像的从零开始的索引。

bHilite
[in] 如果要突出显示图像,则为 TRUE;否则为 FALSE。

bDisabled
[in] 如果要按禁用的样式绘制图像,则为 TRUE;否则为 FALSE。

bIndeterminate
[in] 如果要按不确定状态样式绘制图像,则为 TRUE;否则为 FALSE。

bShadow
[in] 如果要使用投影绘制图像,则为 TRUE;否则为 FALSE。

bInactive
[in] 如果要按非活动状态样式绘制图像,则为 TRUE;否则为 FALSE。

alphaSrc
[in] alpha 通道(不透明度)值。 值 255 表示图像绘制不透明。 值 0 表示图像绘制透明。 此值仅用于 32 位颜色图像和显示 Windows Vista 玻璃样式的图像。

返回值

如果成功显示指定的图像,则为 TRUE;如果图像索引无效或发生其他错误,则为 FALSE。

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);

参数

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

返回值

备注

CMFCToolBarImages::EnableRTL

static void __stdcall EnableRTL(BOOL bIsRTL = TRUE);

参数

[in] bIsRTL

注解

CMFCToolBarImages::EndDrawImage

释放在通过调用 CMFCToolBarImages::Draw 来绘制工具栏图像之后 CMFCToolBarImages::PrepareDrawImage 分配的系统资源。

void EndDrawImage(CAfxDrawState& ds);

参数

ds
[in] 对传递给 PrepareDrawImage 方法的 CAfxDrawState 对象的引用。

CMFCToolBarImages::ExtractIcon

返回工具栏图像中具有指定图像索引的图标。

HICON ExtractIcon(int nIndex);

参数

nIndex
[in] 图像列表中要提取为图标的图像所在的从零开始的索引。

返回值

提取的图标的句柄;如果 nIndex 超过范围,则为 NULL。

CMFCToolBarImages::FillDitheredRect

用工具栏背景色填充矩形。

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

参数

pDC
[in] 指向设备上下文的指针。

rect
[in] 要填充的矩形的坐标。

备注

借助此方法,可使用作为系统颜色 COLOR_BTNFACE 和 COLOR_BTNHIGHLIGHT 的平均值的颜色填充矩形。 如果系统使用 256 种或更少颜色,则改为使用这两种颜色的仿色图案填充矩形。

CMFCToolBarImages::GetAlwaysLight

BOOL GetAlwaysLight() const;

返回值

注解

CMFCToolBarImages::GetCount

返回工具栏图像列表中的图像数。

int GetCount() const;

返回值

CMFCToolBarImages 对象中的图像数。

CMFCToolBarImages::GetDisabledImageAlpha

返回用于已禁用图像的 alpha 通道(不透明度)值。

static BYTE GetDisabledImageAlpha();

返回值

当前 alpha 通道值。

备注

可调用 CMFCToolBarImages::SetDisabledImageAlpha 来更改 alpha 通道值。

CMFCToolBarImages::GetFadedImageAlpha

static BYTE __stdcall GetFadedImageAlpha();

返回值

备注

CMFCToolBarImages::GetImageSize

检索存储在内存中的工具栏图像的大小(源大小),或者在屏幕上绘制的工具栏图像的大小(目标大小)。

SIZE GetImageSize(BOOL bDest=FALSE) const;

参数

bDest
[in] 若要检索目标大小,则为 TRUE;若要检索源图像大小,则为 FALSE。

返回值

一个 SIZE 结构,它指定图像的大小(以像素为单位)。

备注

源图像的大小是存储在 CMFCToolbarImages 对象中的图像的大小。 可调用 CMFCToolBarImages::SetImageSize 来设置源大小。 默认值为 16x15 像素。

默认情况下,目标图像大小 0x0。 调用 CMFCToolBarImages::PrepareDrawImage 时可指定目标大小。 CMFCToolBarImages::EndDrawImage 方法将目标大小重置为默认值。

CMFCToolBarImages::GetImageWell

返回包含所有工具栏图像的位图的句柄。

HBITMAP GetImageWell() const;

返回值

包含工具栏图像的位图的句柄。

备注

工具栏图像存储在称为“图像条”的单个位图中的行中。 若要在图像条中查找工具栏图像,请将图像的索引乘以工具栏图像的宽度(请参阅 CMFCToolBarImages::GetImageSize),以获取图像条中图像的水平偏移量。

CMFCToolBarImages::GetImageWellLight

HBITMAP GetImageWellLight() const;

返回值

备注

CMFCToolBarImages::GetLastImageRect

CRect GetLastImageRect() const;

返回值

备注

CMFCToolBarImages::GetLightPercentage

int GetLightPercentage() const;

返回值

备注

CMFCToolBarImages::GetMapTo3DColors

BOOL GetMapTo3DColors() const;

返回值

注解

CMFCToolBarImages::GetMask

HBITMAP GetMask(int iImage);

参数

[in] iImage

返回值

备注

CMFCToolBarImages::GetResourceOffset

返回指定资源 ID 的图像索引。

int GetResourceOffset(UINT uiResId) const;

参数

uiResId
[in] 图像资源 ID。

返回值

如果方法成功,则为图像索引;如果具有指定资源 ID 的图像不存在,则为 -1。

CMFCToolBarImages::GetTransparentColor

COLORREF GetTransparentColor() const;

返回值

注解

CMFCToolBarImages::GrayImages

将工具栏图像灰显,使其看起来已禁用。

BOOL GrayImages(int nGrayImageLuminancePercentage);

参数

nGrayImageLuminancePercentage
[in] 亮度百分比。

返回值

如果集合中的图像已成功灰显,则为 TRUE;否则为 FALSE。

注解

此方法通过对每个像素的红色、绿色和蓝色分量求平均值,并将结果乘以 nGrayImageLuminancePercentage 再除以 100,来修改工具栏图像。 如果 nGrayImageLuminancePercentage 为零或负值,则改用默认值 130。

注意

如果要撤消更改,必须从源重新加载图像。 为此,可调用 CMFCToolBarImages::LoadCMFCToolBarImages::UpdateImage(仅用于用户定义的图像),或者调用 CMFCToolBarImages::Clear,并通过调用 CMFCToolBarImages::AddIconCMFCToolBarImages::AddImage 来再次添加图像。

CMFCToolBarImages::Is32BitTransparencySupported

指定操作系统是否支持 32 位 alpha 值混合处理。

static BOOL Is32BitTransparencySupported();

返回值

如果支持 32 位 alpha 值混合处理,则为 TRUE;否则为 FALSE。

备注

使用此静态方法可在运行时确定操作系统是否支持 32 位 alpha 值混合处理。 Windows 2000 及更高版本支持此功能。

CMFCToolBarImages::IsPreMultiplyAutoCheck

BOOL IsPreMultiplyAutoCheck() const;

返回值

备注

CMFCToolBarImages::IsReadOnly

指定工具栏图像是否为只读。

BOOL IsReadOnly() const;

返回值

如果工具栏图像为只读,则为 TRUE;否则为 FALSE。

注解

从只读文件中加载具有工具栏图像的位图,或者使用 CMFCToolBarImages::CopyTemp 方法复制位图时,CMFCToolbarImages 对象是只读的。

CMFCToolBarImages::IsRTL

指定是否启用从右到左 (RTL) 支持。

static BOOL IsRTL();

返回值

如果启用了 RTL 支持,则为 TRUE;否则为 FALSE。

注解

将应用程序本地化为从右到左读取的语言(例如阿拉伯语、希伯来语、波斯语或乌尔都语)时,会使用 RTL 支持。

CMFCToolBarImages::IsUserImagesList

指定这组工具栏图像是否包含用户定义的图像。

BOOL IsUserImagesList() const;

返回值

如果 CMFCToolBarImages 对象包含用户定义的工具栏图像,则为 TRUE;否则为 FALSE。

CMFCToolBarImages::IsValid

指示这组工具栏图像是否包含有效的工具栏图像。

BOOL IsValid() const;

返回值

如果 CMFCToolBarImages 对象有效,则为 TRUE;否则为 FALSE。

备注

如果 CMFCToolBarImages 对象对具有工具栏图像的位图的句柄为 NULL,则该对象无效。

CMFCToolBarImages::Load

从系统资源或文件中加载工具栏图像。

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

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

参数

uiResID
[in] 位图资源的 ID。

hinstRes
[in] 资源 DLL 的实例。

bAdd
[in] 若要将加载的位图添加到现有位图,则为 TRUE;若要替换现有位图,则为 FALSE。

lpszBmpFileName
[in] 要从中加载位图的磁盘文件的路径。

nMaxFileSize
[in] 位图文件中的最大字节数;若要在不考虑文件大小的情况下加载位图,则为 0。 如果文件大小超过此最大大小,该方法将返回 FALSE,并且不加载位图。

返回值

如果已成功加载位图,则为 TRUE;否则为 FALSE。

注解

如果文件具有只读属性,则图像列表将标记为只读。

CMFCToolBarImages::LoadStr

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

参数

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

返回值

备注

CMFCToolBarImages::MapFromSysColor

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

参数

[in] color
[in] bUseRGBQUAD

返回值

备注

CMFCToolBarImages::MapTo3dColors

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

参数

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

返回值

注解

CMFCToolBarImages::MapToSysColor

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

参数

[in] color
[in] bUseRGBQUAD

返回值

备注

CMFCToolBarImages::MapToSysColorAlpha

static COLORREF __stdcall MapToSysColorAlpha(COLORREF color);

参数

[in] color

返回值

注解

CMFCToolBarImages::Mirror

将工具栏图像替换为其水平镜像。

BOOL Mirror();

返回值

如果已成功镜像图像,则为 TRUE;否则为 FALSE。

备注

此方法用于支持从右到左书写系统。

CMFCToolBarImages::MirrorBitmap

将位图替换为其水平镜像。

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

参数

hbmp
[in, out] 要镜像的位图的句柄。

cxImage
[in] 图像的宽度(以像素为单位)。

返回值

如果已成功镜像图像,则为 TRUE;否则为 FALSE。

备注

此函数用于支持从右到左书写系统。

CMFCToolBarImages::MirrorBitmapVert

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

参数

[in] hbmp
[in] cyImage

返回值

注解

CMFCToolBarImages::MirrorVert

BOOL MirrorVert();

返回值

注解

CMFCToolBarImages::OnSysColorChange

void OnSysColorChange();

备注

CMFCToolBarImages::PreMultiplyAlpha

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

BOOL PreMultiplyAlpha(HBITMAP hbmp);

参数

[in] hbmp
[in] bAutoCheckPremlt

返回值

注解

CMFCToolBarImages::m_bDisableTrueColorAlpha

如果禁用了 truecolor alpha 混合处理(32 位颜色),则为 TRUE。

static BOOL m_bDisableTrueColorAlpha;

备注

若要为工具栏图像启用 truecolor alpha 混合处理,请将此成员变量设置为 FALSE。

为了实现向后兼容性,默认值为 TRUE。

CMFCToolBarImages::PrepareDrawImage

分配在指定大小下绘制工具栏图像所需的资源。

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

参数

ds
[in] 对 CAfxDrawState 结构的引用,该结构在图像呈现阶段之间存储分配的资源。

sizeImageDest
[in] 指定目标图像的大小。

bFadeInactive
[in] 如果希望非活动图像具有淡化效果,则为 TRUE。

返回值

如果成功分配了绘制工具栏图像所需的资源,则为 TRUE;否则为 FALSE。

备注

调用此方法后,可将 CMFCToolBarImages::Draw 调用任意次数。 绘制完成后,必须调用 CMFCToolBarImages::EndDrawImage 来释放 PrepareDrawImage 分配的资源。

CMFCToolBarImages::Save

如果这组工具栏图像包含用户定义的图像,请将工具栏图像存储在文件中。

BOOL Save(LPCTSTR lpszBmpFileName=NULL);

参数

lpszBmpFileName
磁盘文件的路径。

返回值

如果已成功保存工具栏图像,则为 TRUE;否则为 FALSE。

备注

调用此方法可将用户定义的图像存储到磁盘文件中。 如果 lpszBmpFileName 为 NULL,该方法会将位图存储在 CMFCToolBarImages::Load 方法从中加载位图的文件中。

CMFCToolBarImages::SetAlwaysLight

void SetAlwaysLight(BOOL bAlwaysLight = TRUE);

参数

[in] bAlwaysLight

备注

CMFCToolBarImages::SetDisabledImageAlpha

设置用于已禁用图像的 alpha 通道(不透明度)值。

static void SetDisabledImageAlpha(BYTE nValue);

参数

nValue
[in] alpha 通道的新值。

注解

使用此方法可设置已禁用图像的自定义 alpha 值。 默认值为 127,这会导致禁用的按钮图像呈现半透明。 如果设置值 0,则禁用的图像将完全透明。 如果设置值 255,则禁用的图像将完全不透明。

CMFCToolBarImages::SetFadedImageAlpha

static void __stdcall SetFadedImageAlpha(BYTE nValue);

参数

[in] nValue

注解

CMFCToolBarImages::SetImageSize

设置每个工具栏图像的大小(源大小)。

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

参数

sizeImage
[in] 工具栏图像的新大小。

备注

默认情况下,工具栏图像的大小为 16x15 像素。 如果要使用其他大小的工具栏图像,请调用此方法。

CMFCToolBarImages::SetLightPercentage

void SetLightPercentage(int nValue);

参数

[in] nValue

备注

CMFCToolBarImages::SetMapTo3DColors

void SetMapTo3DColors(BOOL bMapTo3DColors);

参数

[in] bMapTo3DColors

备注

CMFCToolBarImages::SetPreMultiplyAutoCheck

void SetPreMultiplyAutoCheck(BOOL bAuto = TRUE);

参数

[in] bAuto

备注

CMFCToolBarImages::SetSingleImage

void SetSingleImage();

注解

CMFCToolBarImages::SetTransparentColor

设置工具栏图像的透明色。

COLORREF SetTransparentColor(COLORREF clrTransparent);

参数

clrTransparent
[in]“RGB”值。

返回值

上一个透明色。

注解

当你或框架调用 CMFCToolBarImages::Draw 时,该方法不会绘制任何与 clrTransparent 指定的颜色匹配的像素。

CMFCToolBarImages::UpdateImage

从位图更新用户定义的工具栏图像。

BOOL UpdateImage(
    int iImage,
    HBITMAP hbmp);

参数

iImage
[in] 要更新的图像的从零开始的索引。

hbmp
[in] 要从中更新图像的位图的句柄。

返回值

如果已成功更新图像,则为 TRUE;如果图像列表不是用户定义的或临时的,则为 FALSE。

CMFCToolBarImages::ConvertTo32Bits

将带下划线的位图转换为 32 bpp 图像。

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

参数

clrTransparent
指定带下划线的位图的透明色。

注解

CMFCToolBarImages::GetBitsPerPixel

返回带下划线的图像的当前分辨率。

int GetBitsPerPixel() const;

返回值

一个整数值,表示带下划线的图像的当前分辨率(以每像素位数 (bpp) 为单位)。

备注

CMFCToolBarImages::GetScale

返回带下划线的图像的当前缩放比率。

double GetScale() const;

返回值

一个表示当前缩放比率的值。

备注

CMFCToolBarImages::IsScaled

指示是否缩放带下划线的图像。

BOOL IsScaled () const;

返回值

如果缩放带下划线的图像,则为 TRUE;否则为 FALSE。

注解

CMFCToolBarImages::SmoothResize

平滑调整带下划线的图像的大小。

BOOL SmoothResize(double dblImageScale);

参数

dblImageScale
缩放比率。

返回值

如果重设大小成功,则返回 TRUE;否则返回 FALSE。

备注

另请参阅

层次结构图

CObject 类
CMFCToolBar 类
CMFCToolBarButton 类