根据选项卡控件更改触发事件 [英] Firing Events based on Tab Control being changed

查看:70
本文介绍了根据选项卡控件更改触发事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个带有多个选项卡的tabConrol,每个选项卡都有其自己的关联方法,这些方法会根据计时器触发...我想在未激活的页面上停止计时器,只使用计时器启动活动标签.

有人可以给我解释一下该怎么做吗?

提前谢谢.

Donald

Hi,

I have a tabConrol with multiple tabs and each tab has it own associated method(s) that fire based on a Timer...I''d like to stop the timers on the pages that aren''t active and only have the timer firing on for the active tab.

Can someone please explain to me how to go about this?

Thanks in advance.

Donald

推荐答案

我已经很长时间没有使用TabControl了.但是,IIRC,每个TabPage都有一个您可以订阅的VisibleChanged事件. TabControl本身具有可以订阅和使用的Deselected和Selected事件.

无论哪种情况,您都可以获取TabPagem或它的索引,以用于跟踪隐藏的页面和显示的页面.只需跟踪哪个计时器在哪个页面上,并使用给出的信息适当地打开/关闭它们即可.
I haven''t used the TabControl in quite a long time. But, IIRC, every TabPage has a VisibleChanged event you could subscribe to. The TabControl itself has a Deselected and Selected events that you could subscribe to and use.

In either case, you''re getting the TabPagem, or the index of, that you can use to track which page is being hidden and which is being shown. It just a matter of tracking which Timers are on which pages and using the information given to turn them on/off as appropriate.


这篇关于根据选项卡控件更改触发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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