Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在同一个表单上有两个不同的网格控件。它们共享相同的上下文菜单。当我选择上下文菜单项时,我无法确定哪个控件是所有者。
ContextMenuStrip 类的 SourceControl 属性将显示导致显示该菜单条的最后一个控件。
MenuItem 的 Click 事件的事件处理程序将有一个 Sender 参数。该对象应该是显示上下文菜单时具有焦点的控件。