简体   繁体   English

从两个中检测出正在使用哪个监视器/显示器

[英]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. 我目前正在使用一台机器,该机器在其相对的两侧具有2个监视器。 It has a joystick-like 4 buttons to control the movement of the mechanical hand in the center. 它有一个类似于操纵杆的4个按钮,用于控制机械手在中央的移动。 They both display the same screen ie display 1 is duplicated on the 2nd screen. 它们都显示相同的屏幕,即显示器1在第二个屏幕上重复显示。 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. 您将需要引用System.Windows.Forms和System.Drawing框架DLL。

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. 如果我误解了您的问题,这不是您想要的,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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