What's new

Icons for toolbars?

Doomulation

?????????????????????????
Erm... I think I just have some slight little problem...
Thing is, I'm not good at making my own icons, but when I try to copy n' paste (as it even says in the documentation), all I get is a picture with color information lost! How can I actually get the REAL picture in the ms studio?
It works absolutely fine to copy n' paste everywhere as you might just know... I've tried different programs, so it would APPEAR that it's ms visual studio that does something weird here...
 

Niggy G

HTAFC will rise again!!!
Not sure exactly what you mean but do you have to import a pallete before the picture will display the correct pictures?
 
OP
Doomulation

Doomulation

?????????????????????????
I'm just trying to copy and image by opening it and copy the entire contents to the clipboard, then goto the studio and paste it. It looks weird. And that's how the documentation states how you "import" pictures.
 

ShizZy

Emulator Developer
Doomulation, that's because the standard icon format is only 16 colors. The solution is simple - you must overide it with a higher resolution. There should be a drop down menu near the top of the icon editor that says something like "32 by 32 16 colors". Next to it, is a button - click it. A window will come up with a number of different formats for icons.

Find one that is 256 colors and the dimension that you want (probably the 32 by 32 pixel size), and double click it. It should open that version of the icon, which is a blank slate. But if not... select it from the drop down menu I showed you before. Now, paste your picture in there - and it should remain mostly incontact. When I get home I'll show you a screenshot if you still need it.

Cheers.
 

BGNG

New member
Windows icon resources can be up to 32-bit RGBA... Is 256 the highest Visual Studio allows?
 

ShizZy

Emulator Developer
Yeap. Well, it's the highest you can create in MSVC++. If you use an external editor, you can import any type of ICO you'd like.
 
OP
Doomulation

Doomulation

?????????????????????????
Hmmm... can't find it. I'll try to search msdn and see what I come up with.
A quick note is that I'm using visual studio 2003 ide.

EDIT:
Found maybe what I'm looking for... there is a way to change to 256 colors. BUT only with bitmaps (and perhaps icons), not when adding a toolbar resource. Screw you ms... I also noticed the problem when loading toolbars, having 16 colors. I found a sample to override this which naturally doesn't work...

I suppose I'll have to hunt for a sample on the web to do this...
 
Last edited:
OP
Doomulation

Doomulation

?????????????????????????
Okay, I forgot about this problem for a while, but it needs to be dealt with! In msvc .net, 16 colors are the maximum for toolbars! I tried to convert a bitmap, while it pops up a message saying that 16 colors are max for toolbars, do you want to decrease the color depth?

But there are apps out there that uses icons in toolbars more than 16 colors! How did they do? I can't figure it out...
 

smcd

Active member
You can't just add the image from an external editor into your resource script as a bitmap? That's all a toolbar uses is a long strip bitmap.
 

thakis

New member
As sethmcdoogle says, it's probably easiest to use an external program to create the icons. If you want to create icons (not toolbars), I recommend @icon sushi (http://www.towofu.net/soft-e/). For toolbars, paste an image like the attached one together in your favourite paint program (just to show you how a toolbar bmp looks) and attach it as bitmap resource (insert->resource->bitmap).

Alternatively, you can load the "standard" windows toolbar images via the win32api and not include the image as resource at all. A (short) overview how this works is given here:
http://msdn.microsoft.com/library/d...m/commctls/toolbar/structures/tbaddbitmap.asp
if you need more information, tell us :)

edit: bmp attachments are not allowed, so i converted the toolbar to png...you have to use a bmp as resource, though.
edit2: seems as if the alpha channel of the png got messy data during the conversion...all pixels are meant to be non-transparent.
 
Last edited:
OP
Doomulation

Doomulation

?????????????????????????
aprentice said:
why dont you just draw it yourself using gdi?
break free of any restrictions :p
Yes, if need be!

Yes, I was wondering about loading them dynamically...
I will try this out, thanks for the help.
 

Cyberman

Moderator
Moderator
Doomulation said:
Yes, if need be!

Yes, I was wondering about loading them dynamically...
I will try this out, thanks for the help.
Well in BCB I load and play with my icons for a tool bar by creating an image list.
From the image list I add and grab my icons. All Icons are 16 colors. Well not all but if you use the default built in window objects they are. (sigh).
You have a toolbar object right? can you draw onto it's canvas? If so draw the whole thing yourself. For your icons load them into a collection of images. Remember they HAVE to be the same size. Wither 16x16 or 64x64 (grin). I suggest you load your icons at run time and size them into your image list. put the Image list with the tool bar. Then create button objects that use the tool bar as there parent. Create a custom draw proceedure/ function to paint the icon for the button. Be sure each button knows it's icon index too! ;) I'm sure there are other ways to do it. BCB is so much easier to do things in at times.

Ctv
 
OP
Doomulation

Doomulation

?????????????????????????
I don't think I'll be using that...
As things look now, I'll use icons and have the prof-uis library do the rest.
 

Top