postrowski
asked on
How can I display more than 16 colors in my icons?
I have an MFC ActiveX control, that I display from a web page. I want to use more than the standard 16 colors for some of the icons, but it never renders properly.
Does anyone know how to increase the palette size?
Does anyone know how to increase the palette size?
See the article http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/msdn_icons.asp ('Icons in Win32') - maybe this is of some help.
The problem is that by default, VC++ creates 16-color icons. It is easy to fix:
1) In the Resource Editor, create a new icon.
2) From the Image menu, Chhose "New Device Image"
3) Choose 32x32 256 colors (or choose Custom... and make the icon any size you want.
4) Paste a 256-color picture into the icon (I just copy a chunk from a Paint bitmap)
5) Delete the 16-color icon so that there is only one icon for the system to choose when you call LoadIcon, etc.
-- Dan
1) In the Resource Editor, create a new icon.
2) From the Image menu, Chhose "New Device Image"
3) Choose 32x32 256 colors (or choose Custom... and make the icon any size you want.
4) Paste a 256-color picture into the icon (I just copy a chunk from a Paint bitmap)
5) Delete the 16-color icon so that there is only one icon for the system to choose when you call LoadIcon, etc.
-- Dan
ASKER
OK, I did what Dan suggested, and that lets me create 256 color icons fine, but when the control is displayed in the web page, it still shows only the primary 16 colors. I think that somehow I need to realize the new larger palette.
Show the code that you use to render the icon. I suggest using LoadImage(...,IMAGE_ICON,. ..) rather than LoadIcon.
-- Dan
-- Dan
ASKER
I was using LoadIcon:
m_pImageList = new CImageList();
m_pImageList->Create(16, 16, ILC_MASK, 10, 0);
m_pImageList->Add(AfxGetAp p()->LoadI con(IDI_DB _ICON1));
m_pImageList->Add(AfxGetAp p()->LoadI con(IDI_DB _ICON2));
...
m_ctlTree.SetImageList(m_p ImageList, TVSIL_NORMAL);
In this case, I'm loading the icons into a CTreeCtrl.
I also tried using LoadImage:
m_pImageList->Add((HICON): :LoadImage (AfxGetIns tanceHandl e(), MAKEINTRESOURCE(IDI_DB_ICO N1), IMAGE_ICON,0,0,LR_DEFAULTS IZE));
but I have the same problem.
I also have the same problem with the colors that render in my toolbar. For the toolbar, I'm using a 256 color bitmap, but it seems to be rendering as a 16 bit bitmap. I think if I can figure out how to get the toolbar to render properly as a 256 color bitmap, then the palette would be large enough to display my icons correctly in the CTreeCtrl.
m_pImageList = new CImageList();
m_pImageList->Create(16, 16, ILC_MASK, 10, 0);
m_pImageList->Add(AfxGetAp
m_pImageList->Add(AfxGetAp
...
m_ctlTree.SetImageList(m_p
In this case, I'm loading the icons into a CTreeCtrl.
I also tried using LoadImage:
m_pImageList->Add((HICON):
but I have the same problem.
I also have the same problem with the colors that render in my toolbar. For the toolbar, I'm using a 256 color bitmap, but it seems to be rendering as a 16 bit bitmap. I think if I can figure out how to get the toolbar to render properly as a 256 color bitmap, then the palette would be large enough to display my icons correctly in the CTreeCtrl.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: bcox24, DanRollins (points to be split)
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Roshan Davis
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: bcox24, DanRollins (points to be split)
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Roshan Davis
EE Cleanup Volunteer