获取 Windows 上下文菜单选择的位置?

发布于 2024-09-05 20:59:40 字数 254 浏览 1 评论 0原文

我有一个 Windows 上下文菜单项,通过这些注册表项调用 Windows 窗体...

HKLM\Software\Classes\*\shell\myappname
HKLM\Software\Classes\*\shell\myappname\command

但是当我的 Windows 窗体启动时,我希望它位于调用上下文菜单的位置附近。有什么办法可以做到这一点吗?我想我需要获取Windows事件的坐标并设置窗口位置?

I have a Windows context menu item invoking a Windows Form via these registry keys...

HKLM\Software\Classes\*\shell\myappname
HKLM\Software\Classes\*\shell\myappname\command

But when my Windows Form is started, I want it to be located near where the context menu was invoked. Is there any way to do that? I think I need to get the coordinates of the Windows event and set the window location?

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

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

发布评论

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

评论(1

月朦胧 2024-09-12 20:59:40

Your best bet is to use the MousePosition property to get the current mouse pointer position. That will, at least, reduce the distance the user needs to move the mouse to interact with your Windows Form.

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