The top left corner of the screen is (0, 0) i,e, X and Y coordinate is (0, 0). This means that vertical zero is topmost point and horizontal zero is the leftmost point.
So, the task is to find the coordinates of the mouse over the screen.
It can be find using the clientX and clientY property:
- ClientX: It gives the horizontal coordinate of the event.
- ClientY: It gives the vertical coordinate of the mouse.
For X coordinate: event.ClientX For Y coordinate: event.ClientY
Below is the required implementation: