Right click menu under winforms

BCS picture BCS · Jun 30, 2009 · Viewed 13.6k times · Source

I want to make a right click menu for my winforms app. It will have the same two things in it no matter where it pops up. A little hunting and pecking leads me to the conclusion that winforsm either doesn't support this in a trivial way or has hidden it under some name I havn't guessed yet. I think I can make it work with the Click event and manually creating a menu in the right place, bla bla bla... Yuck, I can thing of a half dozon thing right now that I would get wrong the first time around. Someone has got to have a better way.

Am I missing some easy way to add this?

Is there some library/widget I can copy/paste in to handle the grunt work for me?

Answer

MiffTheFox picture MiffTheFox · Jun 30, 2009

Add a System.Windows.Forms.ContextMenuStrip item to the form, then set the form's ContextMenuStrip property.