定時(shí)器控件主要用來計(jì)時(shí)。通過計(jì)時(shí)處理,可以實(shí)現(xiàn)各種復(fù)雜的操作。例如:延時(shí)、動(dòng)畫等。
Timer控件的常用屬性和事件
Timer控件的常用屬性不是狠多,比較常用的是Interval(間隔)屬性,該屬性值決定兩次調(diào)用Timer控件的間隔毫秒數(shù)。Enabled屬性用來控制定時(shí)器控件是否有效,該控件運(yùn)行時(shí)是不可見的。
定時(shí)器控件的屬性雖然不多,但其在動(dòng)畫制作、定期執(zhí)行某個(gè)操作等方面起著重要作用。
定時(shí)器控件的事件只有一個(gè)Tick。用戶可以通過捕捉該事件來對(duì)事件進(jìn)行操作。
Public Class Form12
Dim filesave As Boolean
Private Sub Form12_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
filesave = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Me.Timer1.Enabled = False
If filesave = False Then
MsgBox("文件沒有存儲(chǔ),請(qǐng)及時(shí)存儲(chǔ)!", MsgBoxStyle.OkOnly)
filesave = True
End If
Me.Timer1.Enabled = True
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
filesave = False
End Sub
End Class
12:16:39 |
寫入日志
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。