C#如何在不运行计时器的情况下使代码知道? [英] C# how do I make the code know when a timer is running or not?

查看:116
本文介绍了C#如何在不运行计时器的情况下使代码知道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是代码的样子,但是不起作用

this is what the code looks like but doesn''t work

if (timer1.Start == timer1.Tick )
        {
label1.text = "im ticking";
        }
else
{
label1.text = "im not ticking";
}



所以这就是我的想法,如果timer1在计时时告诉我它的计时,如果不告诉我



so this is what i''m thinking, if timer1 is ticking when tell me its ticking if not don''t tell me

推荐答案

使用Enabled属性为此.




试试这个:
Hi,

Try this:
if (timer1.Enabled==true)
        {
label1.text = "im ticking";
        }
else
{
label1.text = "im not ticking";
}


这篇关于C#如何在不运行计时器的情况下使代码知道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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