我可以在ccomboboxex中拥有超过16个透明图标吗? [英] Can I have more than 16 transparent icons in a ccomboboxex?

查看:65
本文介绍了我可以在ccomboboxex中拥有超过16个透明图标吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎您可以在CComboBoxEx中使用16个透明图标。我有以下伪代码(我添加相同的图标,但你明白了):



 HICON hIcon = AfxGetApp() - > LoadIcon(IDR_MAINFRAME)
m_ImageList.Create( 16 16 ,ILC_COLOR32,< span class =code-digit> 20 , 1 );

for int nImage = 0 ; nImage< 20 ; nImage ++)
{
m_ImageList.Add(hIcon);
}
m_cmbAction.SetImageList(& m_ImageList);



前16个图标都没问题 - 以下几个都有黑色背景而不是透明度。具有与CTreeCtrl或CListCtrl关联的图像列表的相同代码可以很好地工作。我知道这听起来很疯狂,但任何想法?提前致谢



我使用的是Visual Studio 2013,Windows 10.



我是什么尝试过:



如果你想重现,你可以从这里下载代码http://db.tt/ewe3wsQ7gQ



将ILC_MASK添加到CImageList :: Create没有用(并且根据某些来源不应该与ILC_COLOR32一起使用)

解决方案

< blockquote>这是其他人发现的,但我提供参考以供将来参考:我使用CBEIF_OVERLAY添加项目 - 并且存在限制!


It seems that there is a limitation to 16 transparent icons you can use in a CComboBoxEx. I have the following pseudo code (I am adding the same icon but you get the idea):

HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME)
m_ImageList.Create(16,16,ILC_COLOR32,20,1);

for (int nImage = 0; nImage < 20; nImage++)
{
    m_ImageList.Add(hIcon);
}
m_cmbAction.SetImageList(&m_ImageList);


The first 16 icons are OK - the following ones all have a black background instead of the transparency. The same code with an Image list associated to a CTreeCtrl or a CListCtrl works beautifully. I know it sounds crazy but any ideas? Thanks in advance

I am using Visual Studio 2013, Windows 10.

What I have tried:

If you want to reproduce, you can download the code from here http://db.tt/ewe3wsQ7gQ

Adding ILC_MASK to the CImageList::Create does not help (and according to some sources should not be used with ILC_COLOR32)

解决方案

This has been found by someone else but I give the reference for future reference: I was using CBEIF_OVERLAY for adding the items - and there is a limitation there!


这篇关于我可以在ccomboboxex中拥有超过16个透明图标吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆