2019年4月10日 星期三

毫秒不差

PS:毫秒不差(其實是 1 / 60 秒)




Public Class Form1

    Dim count As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Timer1.Enabled = True
        count = 0

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        count = count + 1
        Label1.Text = count Mod 10

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Timer1.Enabled = False
        Label1.Text = (count \ 60) & "." & (count Mod 60)

    End Sub

End Class

沒有留言:

張貼留言