![]() |
Icons in CXTPToolBar |
Post Reply ![]() |
Author | |
GoBeavs ![]() Newbie ![]() Joined: 17 June 2008 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() Posted: 23 June 2008 at 12:31pm |
Hi,
I'm trying to reuse some icons in a toolbar with the following code. { // make the array for the icons UINT icons[] = {0, 0, 0, 0, 0, ID_VALUESET_COMMITCHANGES}; // now set the color icon int index = 0; // if we have a valuset, get the correct color icons[index] = ID_VALUESET_COLOR; // set the icons for the toobar VERIFY(m_MainToolBar->GetImageManager()->SetIcons(IDB_VALUESET, icons, _countof(icons), CSize(32, 32)) ); m_MainToolBar->Invalidate(); } What I'm seeing is that I am always getting the first 2 icons out of IDB_VALUSET which is a .png file. The behavior I desire is to pick icons within that file and set them on particular buttons. m_MainToolBar is a CXTPToolBar. Is it the case that the specification of icons[] is somehow wrong, or is this just not possible with a CXTPToolBar? Thanks, Darin |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Need to see your toolbar resource and your toolbar bitmap to understand what you need.
Attach sample.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
GoBeavs ![]() Newbie ![]() Joined: 17 June 2008 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
Thanks.
We have found 2 ways to resolve this problem and would like to know which is the preferred method. We found empirically that: 1. Since there are 10 images in my .png file, if I change the icon array to have a place for each icon, the code works. UINT icons[] = {0, 0, 0, 0, 0, ID_VALUESET_COMMITCHANGES, 0, 0, 0, 0}; 2. Changing the array to indicate unused icons with -1 makes the icon mapping work UINT icons[] = {-1, -1, -1, -1, -1, ID_VALUESET_COMMITCHANGES}; Which is preferred? I tend to like number 2 because it doesn't require me to know how many icons are in the png file, just account for which ones I'm using. Thanks |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
I'm not even sure that second method really work. if you don't know how many icons in file, how ImageManager have to determine it ?
Use first method.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
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 |