How do I go about making a pop-up menu appear when the user clickes on an item (such as a cell in a list box)?
Printable View
How do I go about making a pop-up menu appear when the user clickes on an item (such as a cell in a list box)?
To start you need to drag a ContextMenu from the toolbox to your form.
Then add menu items to it and the click event procedures.
Then assign the CM to your listbox control.
Couldn't you use a context menu, and use:
ContextMenu1.show(control_name, System.Windows.Forms.Form.MousePosition)
on the click handler?
Bill
Then you would still need to dynamically add menu items and Handlers to it.
Its easier to start with the GUI CM control and go from there unless you already know how to do it all dynamically at run time. ;)
Good point. See, when you learn from books, they don't tell you "It's easier to just click and drag". Good to know how to do it dynamically too though, eh?Quote:
Originally Posted by RobDog888
Bill
Thank you!! Works exactly like I need..Quote:
Originally Posted by RobDog888
:D
Yes, actually I have read things stating that if you use the GUI on things its the exact same thing as doing it
dynamically. Iam not too sure since, like a timer for ex., your filesize will be larger then if you created one dynamically
through code. I dont see how they could differ since the GUI version only dynamically generates the code for you
and add a very small addition to your forms resource file.