32BPP Image Lists in XTPButton |
Post Reply |
Author | |
AndyS
Groupie Joined: 15 December 2004 Location: United Kingdom Status: Offline Points: 14 |
Post Options
Thanks(0)
Posted: 19 May 2009 at 7:21am |
The following works for getting a strip of four alpha icons onto my CXTPButtons.... m_bmpIcons.LoadBitmap(IDB_STRIP_XYZ); m_imageList.Create(16, 16, ILC_COLOR32, 4, 1); m_imageList.Add(&m_bmpIcons, RGB(0,0,0)); ...m_cBtnA.SetIcon(CSize(16,16), m_imageList.ExtractIcon(0)
m_cBtnB.SetIcon(CSize(16,16), m_imageList.ExtractIcon(1)
m_cBtnC.SetIcon(CSize(16,16), m_imageList.ExtractIcon(2)
m_cBtnD.SetIcon(CSize(16,16), m_imageList.ExtractIcon(3)
The problem is that when the button control is disabled the transparent parts render as black. I see the button sample uses discrete bitmaps for each button and that works fine here too but I'd prefer to use an image strip rather than tens of seperate bitmap resources. Can this be done?
Thanks
|
|
AndyS
Groupie Joined: 15 December 2004 Location: United Kingdom Status: Offline Points: 14 |
Post Options
Thanks(0)
|
I think I may have resolved this myself. The problem appears to be in the way CXTPImageManagerIconHandle treats the automatic construction of the disabled icons. The assumption of alpha capability within the CXTPImageManagerIconHandle appears to be driven by whether the icon handle was initialised from an HICON or from an HBITMAP. I guess that's a throwback to before ImageList icons handled alpha.
The fix for me is to always use set the icon from a bitmap but I'd still like to use image strips. For now I've knocked up a support method which pulls a region of the strip bitmap out and uses that to set the bitmap on the button. This keeps my icons in easy to handle strips and avoids image lists entirely.
If I've got this wrong please let me know, or if there's some support methods for single bitmap extraction from toolbar strips already in codejock then that would be good to.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Yes, load images from bitmap or icon directly - standard ImageList support 32bit icons from WindowsXP only.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Vero
Groupie Joined: 25 May 2005 Location: Spain Status: Offline Points: 13 |
Post Options
Thanks(0)
|
Hello,
I have the same problem whith SetBitmap in a CXTButton. With next source:
m_buttonSave.SetBitmap(CSize(32,32), IDB_SAVE); I have the disabled button in black because the bitmap is 32bpp. In previous versions (v9.81) this works fine! Please, can you help me? |
|
Vero
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |