Loading icons other than BMP at runtime? |
Post Reply |
Author | |
Spyder
Newbie Joined: 17 November 2004 Location: Australia Status: Offline Points: 29 |
Post Options
Thanks(0)
Posted: 14 March 2005 at 7:05pm |
I need to load files that could be gif, jpg or bmp at runtime as toolbar icons.
The AddIcon() method claims to take a handle to an icon, but this doesn't work (VB6): Call CommandBars.Icons.AddIcon(LoadPicture("path\to\image.gif").H andle, newBtn.id, xtpImageNormal) Anyone had luck loading a picture that isn't a BMP? |
|
Spyder
Newbie Joined: 17 November 2004 Location: Australia Status: Offline Points: 29 |
Post Options
Thanks(0)
|
bump... nobody has any ideas? :(
|
|
robs
Groupie Joined: 09 November 2003 Status: Offline Points: 84 |
Post Options
Thanks(0)
|
Try this:
http://www.vbaccelerator.com/home/VB/Code/Controls/ImageLi st/index.asp I use it for icons w command bar. Works good. I think I've tried gif and it worked. Can't remember. good luck |
|
Spyder
Newbie Joined: 17 November 2004 Location: Australia Status: Offline Points: 29 |
Post Options
Thanks(0)
|
I thought about using something like that, but I'd rather not add that much code just for this.
Maybe I can extract just the load picture code, hrmm. It doesn't help that the AddIcon() method documentation does not specify how to specify an image handle... |
|
Spyder
Newbie Joined: 17 November 2004 Location: Australia Status: Offline Points: 29 |
Post Options
Thanks(0)
|
OK that nearly worked, but the VBALImageList doesn't support loading images that are different dimensions to the one defined internally.
Guess I'll have to submit this as a support request... |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
LoadPicture.Handle retrieve HBITMAP not HICON. try CommandBars.Icons.AddBitmap instead. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Spyder
Newbie Joined: 17 November 2004 Location: Australia Status: Offline Points: 29 |
Post Options
Thanks(0)
|
That worked, thanks!
You may want to document that method, I couldn't find it in the docs anywhere. |
|
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 |