我目前正在开发一个屏保启动器,但我想延迟激活屏保一段时间,以确保鼠标位置仍在激活它的位置,以防止意外激活。我正在考虑某种线程在执行前检查鼠标位置 x 秒,这是一个明智的解决方案吗?
I'm not writing a screensaver, I have written an application so that when you move your mouse to a designated corner of your desktop, the screensaver comes on... I want to know how to add a delay to when you move the mouse into that corner to prevent accidental launching of the screensaver
如果是怎么办?
最佳答案
so that when you move your mouse to a designated corner of your desktop, the screensaver comes on...
当鼠标到达那里时,设置一个 bool 值和一个计时器。使任何鼠标操作清除 bool 值。
只有当计时器触发并且您的旗帜仍然存在时,才继续。
换句话说,使用一个小的状态机。
关于c# - 延迟某个 Action 一段时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8650194/