Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Right click menu under winforms

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?

like image 859
BCS Avatar asked Jun 30 '09 21:06

BCS


People also ask

How to use ContextMenuStrip in c# Windows application?

You can associate a ContextMenuStrip with any control, and a right mouse click automatically displays the shortcut menu. You can show a ContextMenuStrip programmatically by using the Show method. ContextMenuStrip supports cancelable Opening and Closing events to handle dynamic population and multiple-click scenarios.

What is context menu c#?

C# context menus are the menus that pop up when the user clicks with the right hand mouse button over a control or area in a Windows based form. They are called context menus because the menu is usually specific to the object over which the mouse was clicked.


1 Answers

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

like image 123
MiffTheFox Avatar answered Sep 18 '22 16:09

MiffTheFox