i'd appreciate if someone could give me a hint :)
I have my Windows Forms C#
app and i put the start position to the right side of the screen. Now i'd like it to appear only when the user's cursor touches right side boundary of the screen. How can i track the position of the cursor and show the form?
Thank you in advance!
Asked
Active
Viewed 463 times
0
-
2You are probably asking about how to set up a global hook -- see : http://stackoverflow.com/a/6871142/327083 – J... Mar 06 '13 at 11:37
1 Answers
2
Answering in terms of decomposing the question:
- How do I know where the right side of the screen is?
- How do I know what the position of the mouse cursor is?
That should get you started. I'm assuming you already know how to use a Timer to repeatedly do things (such as poll for the mouse position).
-
But no components are visible at the time, as I understand... But I recall Cursor.Position gets updated anytime. – AKX Mar 06 '13 at 12:41
-
I take it back - this does work in the background. Neat. I still like the idea of a global hook better, though, I think. This way you respond to mouse movement rather than having to poll continuously. Maybe it's an idealist view, but think being given data is more elegant than going to get it. – J... Mar 06 '13 at 12:49
-
Well, it's more elegant, I do agree. But a global hook would receive every single mouse movement event, wouldn't it? In this case the OP probably doesn't need "instant" timing resolution. And last time I checked global hooks weren't exactly the easiest thing to get going. – AKX Mar 06 '13 at 14:58
-