秒计时应在我的应用程序中运行 [英] seconds timing should run in my application
本文介绍了秒计时应在我的应用程序中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要像
2012年6月12日08:10 01(此处01应该增加tat是秒计时)
i need like
jun 12 2012 08:10 01 (here 01 should increase tat is seconds timing)
推荐答案
在表单上添加标签和按钮,然后在button_click上编写以下代码
add a label and a button on your Form then on button_click write the following code
private void btnStart_Click(object sender, EventArgs e) { Timer timer = new Timer(); timer.Start(); timer.Interval = 1; timer.Tick += new EventHandler(timer_Tick); }
void timer_Tick(object sender, EventArgs e) { label1.Text = DateTime.Now.ToString("MM dd yyyy hh:mm:ss.fff"); Update(); }
这篇关于秒计时应在我的应用程序中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文