4

I'm trying to get the position of the cursor from a multi-monitor display. Using

Point cursorPosition = Cursor.Position;

Returns the cursor's position relative to the monitor it is currently on. 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 drew the cursor to an image, it would appear on the left hand side monitor, where as it should be on the right hand side monitor.

EDIT:

I'm taking a screenshot of all my monitors and would like to add the cursor to the Bitmap, however using Cursor.Position will put the cursor on the "left hand side" monitor of the screenshot Bitmap even if the cursor was on the "right hand side" monitor.

Thanks

nd2432
  • 119
  • 2
  • 10

1 Answers1

4

You can get screen where cursor is:

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

Take screen into account before you display your image

vmg
  • 9,920
  • 13
  • 61
  • 90
  • I probably should've been more clear in my question. I'm taking a screenshot of the screen(s) and I get the VirtualScreen size (All my monitors as one). I want to put the cursor in the correct position. This may help, if it does I'll post my answer. – nd2432 May 15 '15 at 21:50
  • The full namespace is `System.Windows.Forms.Screen.FromPoint(Cursor.Position);` in case you are wondering. – vinsa Mar 22 '18 at 23:07