gpt4 book ai didi

c++ - 自定义图像工具栏 WTL

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:54:03 27 4
gpt4 key购买 nike

我想创建一个带有自定义图像按钮的工具栏,我有 .ico 格式的图像,如何将它们添加到 WTL 的工具栏中?我正在尝试编辑工具栏列表中的图片,但质量很差,如何添加质量更好的图片?

最佳答案

如果您有一个已经创建的 WTL 工具栏控件,您可以使用 CToolBarCtrl 的 SetImageList()SetHotImageList() 方法将图像附加到它 类。例如

CToolBarCtrl toolbar;
CImage image;
CBitmap bitmap;

// ... load the image into the bitmap ...

images.Create(32, 32, ILC_COLOR32 | ILC_MASK, 0, 1);

// repeat this for each image you want to use in the toolabr
images.Add(bitmap, RGB(255, 255, 255));

toolbar.SetImageList(images.Detach());

//... do the same for the hot (hover) images ...

然后可以通过引用 CImageList:Add() 方法的返回值来使用图像。

确保像我在此处所做的那样从CImageList 类中分离图像列表,否则图像列表将在超出范围时被删除。

关于c++ - 自定义图像工具栏 WTL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12602734/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com