进程/进度时间剩余格式 [英] Process / Progress Time Remaining Format

查看:70
本文介绍了进程/进度时间剩余格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,此领域中的任何人都可以修改此backgroundworker progresschanged代码段以返回格式为00:00:00(HH:MM:SS)的剩余时间。该代码有效,但它显示0而不是我所需的格式。我提前谢谢你。哦,如果有人
可以更进一步切片另一段代码,我可以修改以给我时间与上面相同的格式,然后我会告诉你生命的秘密。 ..

Hello, can anyone in this realm modify this backgroundworker progresschanged snippet to return the time remaining in the format 00:00:00 (HH:MM:SS). The code works, except it displays 0 instead of my required format. I thank you in advance. Oh, and if anybody can go a step further and slice another piece of code in that I can modify to give me the time elapsed in the same format as above, Then I will let you in on a secret of life...

        private void backgroundWorker1_ProgressChanged(object sender,ProgressChangedEventArgs e)

        {

            DateTime start = DateTime.Now;

            progressBar1.Value = e.ProgressPercentage;

            textBox4.Text = e.ProgressPercentage.ToString()+"%" ;;
        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            DateTime start = DateTime.Now;
            progressBar1.Value = e.ProgressPercentage;
            textBox4.Text = e.ProgressPercentage.ToString() + "%";

推荐答案

为什么不使用timespent.ToString()?

Why not just use timespent.ToString()?

textBox3.Text = timespent.ToString("hh\\:mm\\:ss");


这篇关于进程/进度时间剩余格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆