这个很简单啊,软糖5分钟给你写出来:
先拖三个Button它们的(Name)以及Text属性为:启动、停止和清零
拖一个Label,(Name)为显示时间标签
拖一个Timer,(Name)为Timer1
然后将以下代码覆盖窗体代码就OK了
Imports System.Diagnostics
Public Class Form1
Public 秒表 As New Stopwatch
Private Sub 启动_Click(sender As Object, e As EventArgs) Handles 启动.Click
秒表.Start()
End Sub
Private Sub 停止_Click(sender As Object, e As EventArgs) Handles 停止.Click
秒表.Stop()
End Sub
Private Sub 清零_Click(sender As Object, e As EventArgs) Handles 清零.Click
秒表.Reset()
显示时间标签.Text = 秒表.Elapsed.ToString("mm\:ss\:ff")
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If 秒表.IsRunning Then 显示时间标签.Text = 秒表.Elapsed.ToString("mm\:ss\:ff")
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Interval = 10
Timer1.Enabled = True
End Sub
End Class
下面是运行时的效果图:
看完请采纳,谢谢
我使用的就是vb2010,你什么时候要呢?
秒表还行吧