這是VB Timer 的小測試

 


Public Class Form1
 Dim aa As Boolean
 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 Timer1.Enabled = True
 Timer1.Interval = 10
 aa = True
 End Sub

 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
 If aa = True Then
 Label1.Left -= 1
 If Label1.Left <= 0 Then
 aa = False
 End If
 Else
 Label1.Left += 1
 If Label1.Left + Label1.Width >= Me.Width Then
 aa = True
 End If
 End If
 End Sub

 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
 Application.Exit()
 End Sub

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 Timer1.Enabled = True
 aa = True
 End Sub

 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
 Timer1.Enabled = True
 aa = False
 End Sub

 Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
 Timer1.Enabled = True
 End Sub

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 Timer1.Enabled = False
 End Sub
End Class
文章標籤
全站熱搜
創作者介紹
創作者 Jarvis 的頭像
Jarvis

Jarvis Blog

Jarvis 發表在 痞客邦 留言(0) 人氣(92)