同样,第一步,建个画板
local frm = CreateFrame("Form", "TestF", UIParent)
frm.Visible = true
frm.Caption = "测试用"
1. 创建计时器
local timer = CreateFrame("Timer", "TestT", frm)
现在我们有了一个名为TestT的计时器。记住一点,计时器控件是一个虚拟控件,没有实体存在,只要这样申明下就可以了。
2. 开始计时
timer.Interval = 10
Interval属性是计时器的触发时间间隔值,当设置成10时,从当前时间开始,每10秒会触发计时器的OnTimer事件一次,当设成0时停止计时循环。它的最小值是0.1,即最小计时循环是0.1秒。
3. OnTimer事件
function timer:OnTimer()
frm.Visible = false
self.Interval = 0
end
当计时器被触发时,关闭frm框体,并且置计时器时间为0(即停止计时)。
4. 计时器的销毁
你可以等父框体被Dispose时,系统自己销毁计时器,也可以主动调用下面语句来销毁计时器。
timer:Dispose()
评论
Re
A doctoral degree has to be really important thing for everyone. What companies could aid people in mini dissertation about this post composing? We can suggest to get the dissertation writing at the thesis writing services. Hoping that the proposition will aid students!
Very good work
Very good work
Thanks for the information
Thanks for the information