首页 > 其他 > 详细

Stopwatch Timer 时间 计时器 ElapsedMilliseconds

时间:2020-01-11 17:26:25      阅读:116      评论:0      收藏:0      [点我收藏+]

技术分享图片



/// <summary>
/// 转换成时间 00:00:00
/// </summary>
/// <param name="duration"></param>
/// <returns></returns>
public string time(long duration)
{
    TimeSpan t = new TimeSpan(0, 0, Convert.ToInt32(duration));
    //string str = "00:00:00";
    return   $"{t.Hours:00}:{t.Minutes:00}:{t.Seconds : 00}";
}

int t = 0;
private void timer1_Tick(object sender, EventArgs e)
{
    t++;
    label4.Text =$"时间:{time(t)}";
}



(sw.ElapsedMilliseconds / 1000f).ToString("0.000 sec")

Stopwatch Timer 时间 计时器 ElapsedMilliseconds

原文:https://www.cnblogs.com/xe2011/p/12180436.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!