简体   繁体   中英

Detect which monitor/display is being used out of two

I am currently working on a machine, which has 2 monitors on opposite sides of it. It has a joystick-like 4 buttons to control the movement of the mechanical hand in the center. They both display the same screen ie display 1 is duplicated on the 2nd screen. They both are touch-screen. I want them to work depending on which side user is (ie pressing downward arrow on any screen should move the mechanical hand towards the user). Is there any way I can detect which monitor is being used programmatically (whichever user clicks on)?

Both screens have other info and things, so I can not create two different windows. I can make a button to choose which side user is on but I am keeping it as the second option.

You would need to reference System.Windows.Forms and System.Drawing framework DLLs.

We translate the screen from the current mouse position using below two lines

Screen s = Screen.FromPoint(new System.Drawing.Point(System.Windows.Forms.Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y));

Let me know in case I have misunderstood your question and this is not what you were looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM