计时器显示花费的时间 [英] Timer Displaying Time Spent

查看:57
本文介绍了计时器显示花费的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用了计时器。有两个按钮btnStart和btnEnd所以我想显示开始和结束之间的总时间。请帮帮我....








我有面对此问题我的问题如果我们点击btnstart 然后 如果我们点击btnstop 然后 停止时间显示最后一次(我的意思是总时间) 消息框。





请帮助我......

解决方案

您可以使用秒表类来获取两个实例时间之间的经过时间。



在btnStart上你可以启动秒表,在btnEnd你可以停止它,一旦停止。从秒表获取经过的时间。



秒表类的MSDN文档为, http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch(v = vs.110)的.aspx [ ^ ]

Hi,
I have using timer. There are two button btnStart and btnEnd so i want to show total time between start and end. Please help me....



Hi,
I have not face this problem my question is, if we click btnstart then Start the Time this Format :- HH:MM:SS(starting Time 00:00:00) after then if we click btnstop then stop the time and show the last time(I mean Total Time)in message box.



Please help me......

解决方案

You can use the Stopwatch class to get the elapsed time between some two instances of time.

On the btnStart you can start the Stopwatch and on the btnEnd you can stop it, once stopped. Get the elapsed time from the Stopwatch.

MSDN document for the Stopwatch class is as, http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch(v=vs.110).aspx[^]


这篇关于计时器显示花费的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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