VB.net (desktop) context menu assigned to multiple

2019-07-09 02:09发布

I have two different grid controls on the same form. They share the same context menu. I am having trouble determining which control is the owner when I select the context menu item.

2条回答
再贱就再见
2楼-- · 2019-07-09 02:19

The event handler for the MenuItem's Click event will have a Sender parameter. This object should be the control that had the focus when the context menu was displayed.

查看更多
手持菜刀,她持情操
3楼-- · 2019-07-09 02:37

SourceControl property on the ContextMenuStrip class will show the last control that caused that menu strip to be shown.

查看更多
登录 后发表回答