Hello. I'm sorry for asking this but for the last hour I've been looking for a simple answer to my question and can't find one.
Anyways, I am creating a menu on a VB6 form using the menu editor. (I know there's other controls out there that look way better - but I'm a little leary about using an .ocx I didn't create in my program - and I actually don't think the VB6 menu looks that bad).
How do I place an icon next to my menu item? I am aware of the "SetMenuItemBitmaps" API but this apparently only places a bitmap next to the menu item - whereas I would like to place the .ico file next to it. This is relatively easy to do right??
I'd love to use a coolbar or toolbar for the menu - but it appears to be a lot of work to create a menu that way (or is it?) It's just frustrating because I'm happy with the look of the VB6 menu - which is very easy to create - and all I want to do now is place a little 'ol icon next to the menu item - it must be possible right? I tried using the bitmap but the result looked very poor.
Thanks for the link dee-u. However, as great as that program looks, I'm really just looking for a quick answer. Apparently this must be harder to do than I thought Oh well, I guess I'll just have to live without it (sigh).
For a basic image to be added to a menu you can use the SetMenuItemBitmaps API. To get the handle
of the menus you will need to use GetMenu and GetSubMenu APIs also. If you dont have the API Viewer and API Guide then you will find more info on them in there.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
I already tried using those APIs - the problem was the bitmap looked terrible - perhaps I was using an incorrect size for the bitmap file? Can you enlighten me on what size the bitmap file needs to be? Thanks...
It needs to be 16 x 16. The issue with this API method is that the selection covers the image causing it to
invert and look terrible. You could subclass the menu and do some owner drawing for the cleanest and trickest
look but its allot of work
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Nice link Hack but it contains the same highlighting issue
The only real solution is Owner Drawn menus. The GDI API calls are the ones that you would be interested in.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Yeah that is exactly what I want! - is it that hard to do? I'd be willing to try if I had some code to review. I know how to get the handle of the menu item, so I wouldn't think it be would too difficult beyond that ??
Also, using this approach can you use the icon file instead of a bitmap??
It requires subclassing the menu and measuring and drawing everything on themenu. Text, the selection,
the 3d box, inverting the color of the text when its selected, etc. So no its not hard at all.
If I get some time I can whip up a demo for you, but I nned to finish something first.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Thanks to Hack's link I found some code which I believe already does all that - so don't trouble yourself with putting together a demo for now. I'll try it out later today and if it doesn't work then I may take you up on your offer (as the menus in your screenshot are exactly what I'm trying to achieve...)