Adding icons to menu using SetMenuItemBitmaps 
Author Message
 Adding icons to menu using SetMenuItemBitmaps

Hi,
I use the StretchBlt API call to compress an existing bitmap to the required
size  so that it fits into my menu with clarity.I've used it in the
following way:

x = StretchBlt(Picture2.hdc, 0, 0, 12, 12, Picture1.hdc, 0, 0, 16, 16,
ScrCopy)

As a result, i obtain the compressed bitmap in the picturebox picture2.

But when i use the SetMenuItemBitMaps to set that bmp
in the menu, i'm not getting the picture in the menu.
The following is the line i've coded to set the icon to the menu.
lRet = SetMenuItemBitmaps(hMenu, 3, MF_BYCOMMAND, Picture2.Picture,
Picture2.Picture)

If its an uncompressed bmp, i get it in the menu.
i.e, if i use the picture that is contained in the picturebox picture1, i
get the icon in the menu.

lRet = SetMenuItemBitmaps(hMenu, 3, MF_BYCOMMAND, Picture1.Picture,
Picture1.Picture)

Can anyone help me in solving the problem?
Thanks.
Regards,
Ramya



Sun, 15 Aug 2004 16:56:50 GMT  
 Adding icons to menu using SetMenuItemBitmaps

Quote:
> I use the StretchBlt API call to compress an existing bitmap to the
required
> size  so that it fits into my menu with clarity.I've used it in the
> following way:

> x = StretchBlt(Picture2.hdc, 0, 0, 12, 12, Picture1.hdc, 0, 0, 16, 16,
> ScrCopy)

> As a result, i obtain the compressed bitmap in the picturebox picture2.

<snip>

Try:

Set Picture1.Picture = Picture1.Image

After your call to StretchBlt()
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Sun, 15 Aug 2004 17:05:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. icons on office commandbars with SetMenuItemBitmaps

2. Icon on WindowList menu using MDIChild Form icon.

3. Adding Menu Items to App's System Menu using VB5.0

4. How to add the file associae icon to a menu

5. Can I add icon to menu.

6. Adding custom icons to menus from macro?

7. Adding Icons to the Main Menu...

8. Add Icon in menu

9. Adding Menu Icons

10. Add icon to menu

11. Add icon to menu

12. adding graphics/icon to menu

 

 
Powered by phpBB® Forum Software