Get location of Windows context menu selection?
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 invo开发者_如何学运维ked. Is there any way to do that? I think I need to get the coordinates of the Windows event and set the window location?
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.
精彩评论