i want add a small picture in form menu.when click the picture,the menu list like "maximize,minimize,close.."will pop up. How to write the code?
Printable View
i want add a small picture in form menu.when click the picture,the menu list like "maximize,minimize,close.."will pop up. How to write the code?
well, if you are referring to something similar to the Control icon that is at the top-left corner of most forms that allows you to Minimize, Maximize, close etc..
That is built-in and shows up by default.
If you are just wanting to make your own for anywhere on the form, you can put an image on the form (we'll call it image1)
Then use the VB Menu Editor to create a menu structure that has the items you want to include. Set the first item in the menu to false so it doesn't show up at the menu bar at the top.
Then you can do something like this:
vb Code:
Private Sub image1_Click() Me.PopUpMenu mnuYourMenuName End Sub
This will cause the menu to popup when you click the image.
If this is not what you are looking for, then I apologize for leading you in the wrong direction :)
Are you asking how to add icons to a standard VB drop down menu?
what i want is similar to control icon.Quote:
Originally Posted by Capp
You can set the icon from Form's Icon property. Is it what you want ?
If not, could you please describe a little more ? Perhaps with a picture ?
I think he wants to add another control box to the form. You can't do it in VB without subclassing the form and drawing it yourself.
can somebody provide more in add icons to a standard VB drop down menu?Quote:
Originally Posted by Hack
You'll need SetMenuItemBitmaps API for this. See this pages:
http://support.microsoft.com/kb/71281
http://allapi.mentalis.org/apilist/S...mBitmaps.shtml (example at bottom of the page)
also search the forum for "SetMenuItemBitmaps".
hope it helps.