我正在尝试创建一个秒表,它允许 numbericupdown 根据需要调整时间。现在,如果我在时间流逝时将 numbericupdown 更改为“2”,它将使整个值加倍,包括已经计时的值,这是我不想要的。有没有办法使用秒表来计算从 numbericupdown 的值更改时开始的时间,如果可以的话,有人可以提供一个例子吗?
Dim BTStopWatch1 As New Diagnostics.Stopwatch
Private Sub Timer4_Tick(sender As Object, e As EventArgs) Handles Timer4.Tick
Dim elapsed As TimeSpan = Me.BTStopWatch1.Elapsed
elapsed = New TimeSpan(elapsed.Ticks * NumericUpDown4.Value)
lblBnch.Text = String.Format("{0:00} : {1:00} : {2:00}", Math.Floor(elapsed.TotalHours), elapsed.Minutes, elapsed.Seconds)
End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
Timer4.Start()
Me.BTStopWatch1.Start()
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
Timer4.Stop()
Me.BTStopWatch1.Stop()
End Sub