Get cursor position on multiple monitors?

I am trying to get the cursor position from a multi monitor display. Using

Point cursorPosition = Cursor.Position;

      

Returns the position of the cursor relative to the current monitor. If I had two monitors and I used the above lines of code and my mouse was on my second monitor (which is to the right of my first monitor) and I draw the cursor to the image it will appear on the left side of the monitor on the side where it is should be on the right hand monitor.

EDIT:

I am taking a screenshot of all my monitors and want to add a cursor to the bitmap, however using Cursor.Position will place the cursor on the monitor on the left side of the Bitmap screen even if the cursor was on the “right side” monitor.

thank

+3


source to share


1 answer


You can get the screen the cursor is on:

var screen = Screen.FromPoint(Cursor.Position);

      



Consider the screen before displaying the image

+4


source







All Articles