Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Icon and toolbar in more than 16 colors, i.e 256 colors

Status
Not open for further replies.

werbfred

Programmer
Mar 10, 2001
11
FR
I would like to know how I can change the Icon and the toolbar of and application to let me use more than 16 colors.

I'm able to create an Icon with 256 colors, but how do I associat it to the application. There are many different Icon sizes corresponding to the different states of the application... The 16x16 size one is in the top the application or in the minimized box. And the 32x32 size one is associated with the icon you click when you launch the application. I would like to chnage those ones to 256 colors.

In an other way I would like to use more than 16 colors in the toolbar of a SDI or MDI application...

Someone can help me ? Thanks
 
You can easy replace Icons in Resources with Icons You needs. To do it correct (and nothing more), easy replace *.ico - Files in the res - subfolder of Your VC++ project with Your new Icons (delete old *.ico - files and replace them with Yours renamed to old Files You have deleted) and recompile all. Normally You have at least 2 Icons: IDR_MAINFRAME (you should use the same file name yourapp.ico - this icon is on the top the application or in the minimized box) and IDR_YOURAPPTYPE (file yourappdoc.ico). Do the same with Toolbars (replace the Toolbar.bmp - file with Your Toolbar.bmp file with 256 colors).
 
Please be aware, if the color space of the bmp or icon exceeds a certain amount, visual studio will not allow you to view it but will instead give you an informative message.

Matt
 
I tried out tchouch's method ... but I have black icons instead. I build a toolbar with two 20*20 pixels icons and the result is two black icons. Before I resized the old 16 color Toolbar. What did I wrong ... ?

Thank you
 
I have tried with VC6.0 under Windows 2000 - all works fine. I use icon 96x96 with 256 colors (I have easy created it from winnt256.bmp), icon's file is 20670 Bytes. It must work on WnNT 4.0 too. But if You use Windows 95/98/ME, they have another Functions for Icon handling - it may be the Problem. Can You see an Icon with 256 colors from Windows Explorer. And shows it Visual Studio right too?
I don't understand what do You mean with
" I build a toolbar with two 20*20 pixels icons and the result is two black icons." ? Toolbar is usually Bitmap, what do You do with Icons for Toolbar?
 
Ok, it seems that I wasn't very clear.

The technique for replacing the applications icon works fine. Now the problem I got is using 256 colors images for the buttons in the toolbar.

So to have a simple example I used a toolbar composed of three buttons with a size of 20 by 20 pixels (The resulting Toolbar.bmp is 60 by 20 pixels).

Now what did I do :
First, I droped buttons from the Toolbar original toolbar. To have only three left.
Then with Alt+Enter I changed the button size to 20 by 20.
After this I replaced the Toolbar.bmp by the one I made with PaintShop Pro.
When I retruned to Visual Studio, I'm notfied of the fact that the file associated to the toolbar has been repalced and asks me if I want to reduce the colors to 16. I refuse and see my beautiful Toolbar.bmp in Visual Studio.

But then when I compile the project and run it, I have only black pictures instead of my beautiful 256 color pictures saved in my Toolbar.bmp.

I have Visual C++6.0 with service pack 5 and Windows 2000. So I think that I did something wrong. Can someone tell me what I did wrong ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top