VB.net(桌面)上下文菜单分配给多个控件所有者问题

发布于 2024-07-08 04:51:27 字数 68 浏览 6 评论 0原文

我在同一窗体上有两个不同的网格控件。 它们共享相同的上下文菜单。 当我选择上下文菜单项时,我无法确定哪个控件是所有者。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

多彩岁月 2024-07-15 04:51:27

ContextMenuStrip 类上的 SourceControl 属性将显示导致该菜单条显示的最后一个控件。

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

舟遥客 2024-07-15 04:51:27

MenuItem 的 Click 事件的事件处理程序将有一个 Sender 参数。 该对象应该是显示上下文菜单时获得焦点的控件。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文