如何重置鼠标光标位置c# [英] How to reset mouse cursor position c#

查看:183
本文介绍了如何重置鼠标光标位置c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

工作环境我从事汽车反馈项目,在扩展模式下使用双显示器。屏幕1(非触摸) - 客户服务主管工作屏幕屏幕2(触摸) - 在此屏幕上运行的客户反馈软件,仅在触摸时无法键盘输入。



问题当客户点击屏幕2获取反馈时,光标位置从屏幕1变为屏幕2,这会打扰客户服务主管。



< b>建议的解决方案

我可以运行后台计时器线程,它在1或2毫秒后检查光标位置,如果它在屏幕2上,它将通过重置光标位置将其重新打开。



我想要什么 - 当客户点击屏幕2时,它可以在那里执行点击操作并将焦点恢复到屏幕1上的最后一个活动控制可以是文本框,窗口等。





关于以上解决方案的问题



鼠标点击将在1或2毫秒的时间内完成。

如何将焦点恢复到最后一次激活屏幕上的控制1.

我的主要动机是不要打扰屏幕1执行工作,因为客户屏幕仅在鼠标点击时激活几毫秒。

Working Environment I working on automobile feedback project which work on dual monitor in extended mode. Screen 1(Non Touch) - Customer Care Executive working screen Screen 2(Touch) - Customer feedback software running on this screen, which work only on touch no keyboard input.

Problem When customer click on screen 2 for feedback, cursor position changed from screen 1 to screen 2 which disturb customer care executive.

Proposed Solution
Can i run background timer thread which checks cursor position after 1 or 2 milliseconds if its on screen 2 it will bring it back on by resetting cursor position.

What i want- Is it possible when customer click on screen 2 it perform click operation over there and bring back focus to last active control on screen 1 which can be textbox, window etc.


Questions Regarding above Solution

Will mouse click will be done in 1 or 2 milliseconds time period.
How can i restore focus to last active control on screen 1.
My main motive is not to disturb screen 1 executive working as customer screen will active on mouse click only for few milliseconds.

推荐答案

查看Screen类。它具有允许您确定桌面大小的属性。在扩展模式下,桌面大小将是各个监视器分辨率的总和。



您可以通过Cursor.Position属性设置光标位置。



请注意,Screen和Cursor类位于System.Windows.Forms程序集中。如果它是一个WPF应用程序,你必须添加它作为参考。



https://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.position.aspx [ ^ ]

https:// msdn.microsoft.com/en-us/library/system.windows.forms.screen%28v=vs.110%29.aspx [ ^ ]
Take a look into the Screen class. It has properties that allow you to determine the desktop size. In extended mode the desktop size will be the sum of the resolution of the individual monitors.

You can set the cursor posion by the Cursor.Position property.

Note that the Screen and Cursor classes are in the System.Windows.Forms assembly. You have to add it as a reference, if it's a WPF app.

https://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.position.aspx[^]
https://msdn.microsoft.com/en-us/library/system.windows.forms.screen%28v=vs.110%29.aspx[^]


这篇关于如何重置鼠标光标位置c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆