如何检测我的应用程序在C#中处于空闲状态(包含表格)? [英] How to detect my application is idle in c# (form covered)?

查看:53
本文介绍了如何检测我的应用程序在C#中处于空闲状态(包含表格)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天有这个问题,我看到了这个解决方案:

I have this problem today, i saw this solution:

如何检测我的应用程序在c#中是否闲置?

我尝试过,但是我的表单覆盖了userControls和其他元素,并且mouseover或keydown事件仅在这些元素的空白处触发.

I tried that, but my form is covered with userControls and other elements, and the mouseover or keydown events are only fired in the margins of those elements.

有更好的方法吗?

推荐答案

不需要将解决方案与计时器和鼠标事件结合在一起.只需处理Application.Idle事件.

Hacking together a solution with timers and mouse events is unnecessary. Just handle the Application.Idle event.

Application.Idle += Application_Idle;

private void Application_Idle(object sender, EventArgs e)
{
    //    The application is now idle.
}

这篇关于如何检测我的应用程序在C#中处于空闲状态(包含表格)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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