It works within a specific control, but it doesn't work out the specific control.
How to get mouse position and use mouse events independently of any control just directly from screen (without Platform Invoke)?
2 needed points:
- Mouse events when mouse is not within a control, but on a screen.
- Mouse position when mouse is not within a control, but on a screen.
It should be solved without using Platform Invoke.
Next two don't work:
System.Windows.Input.Mouse.GetPosition(this)
Doesn't get mouse position out a specific control.
System.Windows.Forms.Cursor.Position.X
System.Windows.Forms.Cursor.Position
doesn't work because it has no types in a WPF app, but it works in a Windows Forms app.
IntelliSense gets System.Windows.Forms.Cursor.Position, but it doesn't get any type of Position, hence I can't get:
Position.X
Position.Y
and
Point pointToWindow = Mouse.GetPosition(this);
Point pointToScreen = PointToScreen(pointToWindow);
Doesn't get mouse position out a specific control.