Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - 32BPP Image Lists in XTPButton
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

32BPP Image Lists in XTPButton

 Post Reply Post Reply
Author
Message
AndyS View Drop Down
Groupie
Groupie


Joined: 15 December 2004
Location: United Kingdom
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndyS Quote  Post ReplyReply Direct Link To This Post Topic: 32BPP Image Lists in XTPButton
    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
 
 
Back to Top
AndyS View Drop Down
Groupie
Groupie


Joined: 15 December 2004
Location: United Kingdom
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndyS Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2009 at 9:10am
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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2009 at 2:16am
Hi,
 
Yes, load images from bitmap or icon directly - standard ImageList support 32bit icons from WindowsXP only.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Vero View Drop Down
Groupie
Groupie
Avatar

Joined: 25 May 2005
Location: Spain
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote Vero Quote  Post ReplyReply Direct Link To This Post Posted: 08 October 2009 at 4:04am
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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.