Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - Adding Alphaicons to Toolbar at Runtime
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Adding Alphaicons to Toolbar at Runtime

 Post Reply Post Reply
Author
Message
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Topic: Adding Alphaicons to Toolbar at Runtime
    Posted: 31 March 2005 at 8:48am

Hello!

I've got one question to Alphaicons in the CommandBar (and the menus created with the CommandBar-ActiveX). How can I add Buttons with Aplhaicons at runtime. I want to do that like it is showed in the "ShortCutBarReport-Sample", but the only difference is that I want to use Alphaicons (when possible from one file) and not like in the sample, bitmaps (from one file).

I hope you can understand me!

Yours,

Finn!

PS.: Sorry for my bad English!

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 8:54am
Something like:

    Dim CommandBarIconArray(0 To 7) As Long
   
    CommandBarIconArray(0) = ID_FILE_NEW
    CommandBarIconArray(1) = ID_FILE_OPEN
    CommandBarIconArray(2) = ID_FILE_SAVE
    CommandBarIconArray(3) = ID_EDIT_CUT
    CommandBarIconArray(4) = ID_EDIT_COPY
    CommandBarIconArray(5) = ID_EDIT_PASTE
    CommandBarIconArray(6) = ID_FILE_PRINT
    CommandBarIconArray(7) = ID_HELP_ABOUT
      
    If ImageManager.IsAlphaIconsSupported Then
        ImageManager.I cons.LoadBitmap App.Path & "\Icons\ToolBarAlpha.bmp", CommandBarIconArray, xtpImageNormal
    Else
        ImageManager.I cons.LoadBitmap App.Path & "\Icons\ToolBar.bmp", CommandBarIconArray, xtpImageNormal
    End If

Notice I have 2 bitmap files, one that has Alpha Icons, the other does not.  Also note that the bitmap file contains exactly 8 16x16 icons.  So I must have 8 elements in the CommandBarIconArray, each aqssigned the id of a control.
Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 8:57am
Thank you! But how can I use Alphaicons with a bitmap file?
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 9:00am
If Alpha Icons are supported, then the image manager does all the work for you.  You simply provide the bitmap with Alpha Icons.
Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 9:04am

OK! But how can I get the Alpha Icons into the bitmap?

PS.: Sorry, that I ask so many questions, but I didn't understand how to add Alpha Icons at runtime.

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 9:08am
You must create the AlphaIcons yourself.  The bitmap will be a 32 bit bitmap with the Alpha Channel.  There are several programs that can be used to create them.
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 9:09am
For example, you can use Axialis IconWorkshop to create the icons and export them as a bitmap.
Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 9:10am
I already have the Alpha Icons I want to use in the *.ico format. Know I have to know how to convert them to the bitmap format.
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 9:11am
Then use a program like the one I suggested to export the file as a bitmap.
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 9:18am
Do you have allot of icons?  Maybe you can send them to me and I can export them as a bitmap for you.  As an alternative, if you load all of your icons into the image manager at design time, you can export them as a bitmap (not sure if it will presrve alpha channel).
Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 9:43am

That would be very very very ... very very nice of you!

In the attached zip file there are all icons I want to use (there a lot, exactly 338 !!!).

The size of the zip file is 20 MB!

You find the icons by clicking at the following link:

http://www.quickklick.net/downloads/Icons.zip

Please send me an e-Mail when you finished converting the icons! My e-Mail-Adress is "finnteegen @ foni.net". The spaces are only for protection against spam-e-Mails.

Yours,

Finn!

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 10:41am
That is allot of icons.  I'm sorry, but I really don't have time to convert that many icons.  Each of your icons have 8 different sizes, that amounts to over 2700 bitmaps to extract and make bitmap lists.  When I asked the question I was thinking something like 50 icons or so.  I can extract really quick, but it would take a long time to manually make the lists.
Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 10:54am

Sorry! I didn't say it, but you only have to extract the icons in the format 16x16. I hope then it will be possible to extract them!

Yours,

Finn!

Back to Top
gshawn View Drop Down
Senior Member
Senior Member


Joined: 04 October 2004
Status: Offline
Points: 227
Post Options Post Options   Thanks (0) Thanks(0)   Quote gshawn Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2005 at 11:19am

lol Supermario, you dug your own grave :)

Finn, that's still 338 icons to compile into a bitmap... That would be very time consuming. Why not create a list of only the icons you will be using in your application? Surely you don't need 4 different printer icons, 4 different recycle bin icons, 4 different bookmark icons, etc..

Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2005 at 12:09am

http://ark42.com/freeimage/alphahlp.exe is a free program (command line utility) that can convert/split/join alpha stuff.

alphahlp -fico -cbmp file.ico file.bmp

will convert a ico to a bmp
You can also tile them into a larger .bmp then like

alphahlp -fbmp -i -w16 -h16 -c0 imagestrip.bmp singleimage.bmp

Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2005 at 3:36am

Thank you, but can I also convert all icons into the bitmap format in one progress (sorry, but I don't how to say that )?

Yours,

Finn!

Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2005 at 11:04am
If you are using 2000 or XP, which any programmer probably is, just use "for"...




Edited by Ark42
Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2005 at 11:24am
Sorry, but what do you mean with that (use "for"...)?
Back to Top
gshawn View Drop Down
Senior Member
Senior Member


Joined: 04 October 2004
Status: Offline
Points: 227
Post Options Post Options   Thanks (0) Thanks(0)   Quote gshawn Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2005 at 11:54am

Try something like this:

for %f in (*.ico) do alphahlp -fico -cbmp %f %f.bmp

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2005 at 12:21pm
Ok, with the help of Ark42 and gshawn this was too easy.  I first extracted all the bmp versions of the icon, then I used Ark42's utility to merge them into one big list.

2005-04-01_121722_imagelist.zip

I used this:
for %f in (*.bmp) do alphahlp -fbmp -i -w16 -h16 -c0 imagelist.bmp "%f"

This code assumes all the bmp files are int he same directory and that you created a dummy bmp file called imagelist.bmp to hold all the images.  The first icon in the list might be the dummy image i used to start the list.

(I already had the images extrated as bmp files from earlier using Axialis IconWorkshop, but it appears Ark42's utillity would do this as well)
Back to Top
gshawn View Drop Down
Senior Member
Senior Member


Joined: 04 October 2004
Status: Offline
Points: 227
Post Options Post Options   Thanks (0) Thanks(0)   Quote gshawn Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2005 at 12:30pm

To expand a little bit more… “For” is a standard Windows 2000/XP command. See http://www.microsoft.com/resources/documentation/windows/xp/ all/proddocs/en-us/ntcmds.mspx#EQAA ).

 

You should follow these steps... more or less:

 

1) Place alphahlp.exe in your System32 folder or somewhere in your %PATH%

2) Shell to the command prompt by running “CMD.exe”

3) Navigate to the folder where your icons are located

4) Run “for %f in (*.ico) do alphahlp -fico -cbmp %f %f.bmp” to create a 32-bit bitmap for each of the icons in the folder

5) Rename one of these bitmaps to “finalstrip.bmp” This will be the first image your strip.

6) Run “for %f in (*.ico.bmp) do alphahlp -fbmp -i -w16 -h16 -c0 finalstrip.bmp %f” to append the rest of the bitmaps to finalstrip.bmp

 

I hope this helps, and kudos to Ark42 for a great suggestion.

 

Back to Top
gshawn View Drop Down
Senior Member
Senior Member


Joined: 04 October 2004
Status: Offline
Points: 227
Post Options Post Options   Thanks (0) Thanks(0)   Quote gshawn Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2005 at 12:32pm

Ah well there you go, 10 minutes too late :)

I'm still glad I researched it though, I learned quite a bit

Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 01 April 2005 at 12:45pm
I know that having the list have to exist for seems annoying, but I usually do something like:

@echo off
for %%f in (*.bmp) do (
if exist imagelist.bmp (
alphahlp -fbmp -i -w16 -h16 -c0 imagelist.bmp "%%f"
) else (
copy %%f imagelist.bmp
)
)

and put it in a file like MakeIcons.cmd
(my actual script is pages long and full of other icon generating stuff)

Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2005 at 10:11am

Hello!

@Ark42: That tipp does not work! I don't know why!

@gshawn: That tipp works much better, but there still is a problem: At some files (which is an icon file) alphahlp gave the error message, that the icon isn't an ICO file. And most of the icons aplhahlp extracted are not in the format 16x16 (only a few).

@SuperMario: Yours version is the best. Your imagelist ist very good and works with my program. Thank you very much!!!

And to the others (Ark42 and gshawn): Also "Thank you" to you!

Yours,

Finn!

Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 4:45am

Hello! Here I am again!

Now I have three 32-it Icons more. How can I add them to your images list. If I use Axialis IconWorkshop and add the converted icons to the imagelist, my application doesn't show the icons in the xp style anymore. And I don't know how to convert them with "alphahlp".

I hope anyone of you can help me!

Yours,

Finn!

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 7:18am
Steps to extract alpha bmp images in Axlias:
1. File->Open->(Open ICO of image you wish to add)
2. Click on the 16x16 version of the ICO file that was opened.
3. File->Export->Image
4. Select "Preserve Alpha Transparency" from the dialog that pops up and select "OK"
5.  Give the new bmp a name and save it.

Then with Ark's utility....

alphahlp -fbmp -i -w16 -h16 -c0 imagelist.bmp NewImage1.bmp
alphahlp -fbmp -i -w16 -h16 -c0 imagelist.bmp NewImage2.bmp
alphahlp -fbmp -i -w16 -h16 -c0 imagelist.bmp NewImage3.bmp


Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 8:08am

Thank you! It works very well!

Yours,

Finn!

Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 9:58am

alphahlp can split icons as such:

alphahlp -fico -m file.ico file- .ico

This will generate a new icon for each sub-icon. For example, it might generate:
file-0-16x16-8.ico
file-1-16x16-32.ico
file-2-32x32-8.ico
file-3-32x32-32.ico
file-4-48x48-8.ico
file-5-48x48-32.ico

If you had 6 different icon pages in the multipage icon file (256 color, and 32bit with alpha channel, 3 different sizes each)

You can convert to .bmp like:

alphahlp -fico -cbmp file-1-16x16-32.ico file.bmp

Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 10:03am

Thank you! I looked at the alphahlp help and saw how to convert icons from one format into the other! But alphahlp is much easier than IconWorkshop from Axialis, because you can run it from the command line!

Yours,

Finn!

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 10:05am
And it's free! 
Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 10:08am

Yes!!! I think for each program which is shareware, you found a program with the same functionallity which is free!

Thank you to both of you (SuperMario and Ark42) for your help!

Yours,

Finn!

Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 10:12am
I wouldn't say 'found' .. I wrote alphahlp, which is based on the FreeImage library, which I also contribute to quite alot.
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 10:14am
Yes, very nice work Ark42
Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 10:14am
Sorry, that I wrote "found"...
Back to Top
gshawn View Drop Down
Senior Member
Senior Member


Joined: 04 October 2004
Status: Offline
Points: 227
Post Options Post Options   Thanks (0) Thanks(0)   Quote gshawn Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 10:24am

Wow, that's awesome :)

Thanks for sharing!

 

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.