简体   繁体   English

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

[英]Get location of Windows context menu selection?

I have a Windows context menu item invoking a Windows Form via these registry keys... 我有一个Windows上下文菜单项通过这些注册表项调用Windows窗体...

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. 但是当我的Windows窗体启动时,我希望它位于调用上下文菜单的位置附近。 Is there any way to do that? 有没有办法做到这一点? I think I need to get the coordinates of the Windows event and set the window location? 我想我需要获取Windows事件的坐标并设置窗口位置?

Your best bet is to use the MousePosition property to get the current mouse pointer position. 最好的办法是使用MousePosition属性获取当前鼠标指针的位置。 That will, at least, reduce the distance the user needs to move the mouse to interact with your Windows Form. 这将至少减少用户移动鼠标与Windows窗体交互所需的距离。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM