当用户离开当前窗口时暂停的计时器 [英] timer which pauses when the user leaves the current window

查看:73
本文介绍了当用户离开当前窗口时暂停的计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计,

i需要你的帮助。

i想要设计一个计时器,只要用户进入新标签或当前窗口失去焦点,该计时器就会暂停。

plz help

Guys,
i need ur help.
i want to design a timer which pauses whenever a user enters a new tab or the current window loses focus.
plz help

推荐答案

每个控件都有丢失焦点事件 [ ^ ]当该控件失去焦点时捕获。

捕获选项卡或窗口的丢失焦点事件然后停止此事件的计时器。
Every control has a lost focus event[^] that is captured when that control looses focus.
Capture the lost focus event for the tab or window and then stop the timer on this event.


这篇关于当用户离开当前窗口时暂停的计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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