[英]vb.net time elapsed & time remaining according from progressbar value
i can calculate only percentage..我只能计算百分比..
so can you gudie me about time elapsed and time remaining from progressbar value?那么你能告诉我关于进度条值的经过时间和剩余时间吗?
this is my code这是我的代码
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
percent = percent + 1
Label1.Text = percent
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 100
If ProgressBar1.Value = 100 Then
Timer1.Stop()
MsgBox("done")
Else
ProgressBar1.Value = percent
show_percent.Text = String.Format("{0:F0}%", ((ProgressBar1.Value / ProgressBar1.Maximum) * 100))
End If
End Sub
You would calculate the elapsed time using a Stopwatch
.您将使用
Stopwatch
计算经过的时间。 Calculating the expected total time and time remaining from that is simple arithmetic.计算预期的总时间和剩余时间是简单的算术。 Total time is elapsed time multiplied by maximum divided by the current and the remaining time is the total time less the elapsed time.
总时间是经过时间乘以最大值除以当前时间,剩余时间是总时间减去经过时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.