![]() |
Loading icon with alpha for use with XTP |
Post Reply
|
| Author | |
robosport
Groupie
Joined: 20 June 2005 Location: United States Status: Offline Points: 62 |
Post Options
Thanks(0)
Quote Reply
Topic: Loading icon with alpha for use with XTPPosted: 27 April 2007 at 1:56am |
|
I have a full color icon with alpha channel (okay, lots of icons). For the last couple years I've used the CommandBar designer to input icons as part of the interface I made with XTP and MFC.
I'm making a dynamic menu now and the icons are loaded at runtime either from memory buffer or from ICO file. I'm using the same ICO file imported into CommandBar Designer (and using Axialis) to confirm the icon has all the bits including alpha included in the file.
My question is: What is the correct way to load an icon, either from ICO file or from bits in memory, so that it works correctly with XTP's controls and compositing. When I use ExtractIcon it doesn't preserve the alpha. When I use LoadImage I get mixed results based on settings but nothing seems quite right.
Any pointers are appreciated.
Thanks! |
|
![]() |
|
robosport
Groupie
Joined: 20 June 2005 Location: United States Status: Offline Points: 62 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 April 2007 at 3:12am |
|
Here is a little more information... my app is using the icon shadows and faded icons features of the paint manager.
When I turn off icon shadows and faded icons the imported icons (using LoadImage) work perfectly.
When I have faded icons turned on the icon doesn't show up (except for a very very faint outline on right and bottom). WHen I mouse over the icon (turning off the faded state) the icon looks perfect.
When I have icon shadows turned on the icon offsets correctly when moused over but the shadow is not drawn (again except for the very very faint edge).
Do I have to do something special with the HICON other than SetCustomIcon when adding it to the dynamically generated button for these two features to work?
Thanks!
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 April 2007 at 4:00am |
|
Hi,
Don't use LoadImage or SetCustomIcon.
use this method:
BOOL CXTPImageManager::SetIcon(UINT nIDResourceIcon, UINT nIDCommand, CSize szIcon, XTPImageState imageState)
where nIDResourceIcon is your Alpha ico file resource. - it will load alpha icon and set it for nIDCommand command.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
robosport
Groupie
Joined: 20 June 2005 Location: United States Status: Offline Points: 62 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 April 2007 at 4:06am |
|
Does CXTPImageManager::SetIcon work with an external ICO file or a memory buffer (preferably), or am I forced to use a resource ID from my EXE (or other resouce DLL)? |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 April 2007 at 6:51am |
|
Hi,
You can load external ICO with
HBITMAP CXTPImageManagerIcon::LoadAlphaIcon(LPCTSTR pszFileName, int nWidth)
method and then add it with
CXTPImageManager::SetIcon(CXTPImageManagerIconHandle hIcon, UINT nIDCommand, CSize szIcon, XTPImageState imageState)
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
robosport
Groupie
Joined: 20 June 2005 Location: United States Status: Offline Points: 62 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 April 2007 at 12:55pm |
|
Thanks Oleg!
|
|
![]() |
|
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 |