Determine what control the ContextMenuStrip was used on

For a ContextMenu: The problem is that the sender parameter points to the item on the context menu that was clicked, not the context menu itself. It’s a simple fix, though, because each MenuItem exposes a GetContextMenu method that will tell you which ContextMenu contains that menu item. Change your code to the following: private … Read more