How to create a menu with sub menu with image

How to create a menu with sub menu with image

kelcyo
Contributor Contributor
683 Views
1 Reply
Message 1 of 2

How to create a menu with sub menu with image

kelcyo
Contributor
Contributor

Hi,

 

Someone can give an example of how to create a menu and include a sub menu with image?

I wonder in NET, because using COM have seen some examples more cannot put the image on the MenuItem.

Grateful.

0 Likes
684 Views
1 Reply
Reply (1)
Message 2 of 2

chiefbraincloud
Collaborator
Collaborator

I was successful at putting an icon on a submenu item on the contextmenu (right click), but I do not see how to do it if you are talking about the main Pulldown menubar.

 

On the context menu, it is simple.  There is an overload of the New Constructor for MenuItem that accepts an Icon parameter.  It did act a little wierd though.  I created an Icon and tested my code, and it failed saying the Icon had to be a 16x16 Icon, I had made mine 32x32.  Then I changed the Icon to 16x16 and it still  gave the error.  So I passed it a newly created icon like this:   

 New Drawing.Icon(My.Resources.Icon1, 16, 16)

and that worked.

In terms of creating the ContextMenuExtension in the first place, there is a post (actually mulitple posts) on Kean Walmsley's Blog.

http://through-the-interface.typepad.com/through_the_interface/2007/05/its_all_in_the_.html

Dave O.                                                                  Sig-Logos32.png
0 Likes