我越來越想顯示操作的時間remainig顯示剩餘時間時間跨度
的問題是隻能用剩下的計時器,我得到一個負值的問題...
這是一個例子10000毫秒(10秒)一個操作:
所以無論如何,如果我刪除「 - 」從時間跨度小時和分鐘劇照incorrects值字符...
Dim time_out as integer = 60000 ' 'Milisegundos
Dim StartTime As DateTime ' Tiempo inicio
Dim EndTime As DateTime ' Tiempo final
Dim ElapsedTime As TimeSpan ' Tiempo transcurrido
Dim RemainingTime As TimeSpan ' Tiempo restante
' Elapsed Time
#Region " Elapsed Time Function "
Public Function Print_Elapsed_Time()
If StartTime.ToString = "01/01/0001 0:00:00" Then
StartTime = Now
StartTime = StartTime.AddSeconds(-1)
End If
ElapsedTime = Now().Subtract(StartTime)
Return String.Format("{0:00}:{1:00}:{2:00}", CInt(Math.Floor(ElapsedTime.TotalHours)) Mod 60, CInt(Math.Floor(ElapsedTime.TotalMinutes)) Mod 60, CInt(Math.Floor(ElapsedTime.TotalSeconds)) Mod 60)
End Function
#End Region
#Region " Remaining Time Function "
Public Function Print_Remaining_Time()
If EndTime.ToString = "01/01/0001 0:00:00" Then
EndTime = Now
EndTime = EndTime.AddMilliseconds(Time_Out - 1000)
End If
RemainingTime = Now().Subtract(EndTime)
Return String.Format("{0:00}:{1:00}:{2:00}", CInt(Math.Floor(RemainingTime.TotalHours)) Mod 60, CInt(Math.Floor(RemainingTime.TotalMinutes)) Mod 60, CInt(Math.Floor(RemainingTime.TotalSeconds)) Mod 60).Replace("-", "")
End Function
#End Region
Thankyou簡單的解決方案! – ElektroStudios 2013-03-18 18:47:10