时间显示在30秒内 [英] Time display in 30 seconds

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

问题描述

嗨 我正在使用Windows应用程序,
我希望在30秒自动超时后仅显示30秒,时间格式为00:00:00希望有人通过这种方式帮助我

Hi I am using windows application,
I want display time only 30 seconds after 30 seconds automatically timeout,the time format is 00:00:00 want this way anyone help me

推荐答案

创建计时器
创建一个班级超时计数器.
将间隔设置为1/10秒.
订阅Tick事件
将超时计数器设置为300(每秒10次30次)
启动计时器.
在刻度"处理程序中,在标签中显示经过的时间.
将超时计数器减少一.
如果计数器小于或等于0,请停止计时器,然后执行所需的任何操作.
Create a timer
Create a class level timeout counter.
Set the interval to 1/10th second.
Subscribe to the Tick event
Set the timeout counter to 300 (30 times 10 times a second)
Start the timer.
In the Tick handler, show the elapsed time in a label.
Reduce the timeout counter by one.
If the counter is less than or equal to 0, stop the timer, and do whatever it is you wanted.


http://msdn.microsoft.com/en-us/library/system.diagnostics. stopwatch.aspx [ ^ ]

谢谢
--RA
Stopwatch[^] control may helps you

See the below link also
http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx[^]

Thanks
--RA


使用计时器控件

http://www.morkalork.com/mork/article/47/How_to_use_the_timer_control_in_C [ ^ ]
use timer control

http://www.morkalork.com/mork/article/47/How_to_use_the_timer_control_in_C[^]


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

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