WPF信息亭应用程序C#的特定光标速度

在WPF应用程序中处理鼠标速度变化的最佳方法是什么?

编辑以获取更多上下文:

我正在开发一个可在Windows 10中运行的自助服务终端应用程序。它具有自己的鼠标速度控制设置页,并且默认速度比正常速度慢得多。我之前的程序员让应用程序在指针进入应用程序边界时将信息亭应用程序的指针速度设置为默认值,并检查指针是否超出界限以恢复速度。

所以我和我的团队在开发过程中遇到了问题。如果系统鼠标速度在Visual Studio中达到断点,则保持设置为信息亭应用程序的速度。在生产中,不应出现这种情况,因为用户将无法离开应用程序。这就是为什么我很难找到一种更好的更改鼠标速度的方法。

This question要求类似的内容,但不是我想要的。

woshilaofu 回答:WPF信息亭应用程序C#的特定光标速度

您已经回答了问题。
在回车时设置系统鼠标速度,并在回车时重置系统鼠标速度。
在应用程序关闭时将其重置。

将原始鼠标速度存储在某个静态变量中。

看一下这个线程: Dynamically changing Mouse speed

您可以捕获所有未处理的异常:

// UI exceptions
Application.ThreadException += HandleErrorUI;

// Set the unhandled exception mode to force all Windows Forms errors
// to go through our handler.
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

// Add the event handler for handling non-UI thread exceptions to the event. 
AppDomain.CurrentDomain.UnhandledException += HandleError;
// handle all task exceptions
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

然后,如果出现任何未处理的错误,请重置鼠标光标速度。

本文链接:https://www.f2er.com/3141716.html

大家都在问