本文介绍了我不能开始计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!


我有一个显示信息的控件...

我为它添加了一个计时器

每次应该显示一个noew mesaage我执行以下操作:


私有子ShowMsg(消息为字符串)

Me.lblStatus.Text =消息

tmrStatus.Start()

tmrStatus.Interval = 3000

tmrStatus.Enabled = True

End Sub

Private Sub tmrStatus_Tick(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理tmrStatus.Tick

如果statusColor.Equals(Color.Lime)然后

statusColor = Color.Green

否则

statusColor = Color.Lime

结束如果

Me.lblStatus.Refresh()

如果flashTime = MaxFlashes那么

flashTime = 0

tmrStatus.Stop()

否则

flashTime + = 1

结束如果

结束子

计时器处理程序永远不会被叫.. ShowMsg工作正常......这里有什么问题?


- -

Ceers,

Crirus


------------------ ------------

如果工作是好事,老板会把这一切都从你那里拿走


--- ---------------------------

Hi!

I havea control that display messages...
I added a timer to it
Every time a noew mesaage should be displayed I do the following:

Private sub ShowMsg(message as string)
Me.lblStatus.Text = message
tmrStatus.Start()
tmrStatus.Interval = 3000
tmrStatus.Enabled = True
End Sub
Private Sub tmrStatus_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles tmrStatus.Tick
If statusColor.Equals(Color.Lime) Then
statusColor = Color.Green
Else
statusColor = Color.Lime
End If
Me.lblStatus.Refresh()
If flashTime = MaxFlashes Then
flashTime = 0
tmrStatus.Stop()
Else
flashTime += 1
End If
End Sub
The timer handler is never called.. ShowMsg work ok... what''s wrong here?

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

推荐答案








A''系统。 Windows.Forms.Timer''?


-

Herfried K. Wagner

MVP·VB Classic,VB.NET

< http://www.mvps.org/dotnet>



A ''System.Windows.Forms.Timer''?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>


这篇关于我不能开始计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-16 07:14