silverlight Timer

 1 publicpartialclass Timer : UserControl
2 {
3 public Timer()
4 {
5 // 为初始化变量所必需
6 InitializeComponent();
7 DispatcherTimer timer =new DispatcherTimer();
8 timer.Interval =new TimeSpan(0, 0, 1);
9 timer.Tick +=new EventHandler(timer_Tick);
10 timer.Start();
11 }
12
13 void timer_Tick(object sender, EventArgs e)
14 {
15 tbkTimer.Text ="当前时间:"+ DateTime.Now.ToLongTimeString();
16 }
17 }
作者:Bonker
出处:http://www.cnblogs.com/Bonker
QQ:519841366
       
本页版权归作者和博客园所有,欢迎转载,但未经作者同意必须保留此段声明, 且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利
原文地址:https://www.cnblogs.com/Bonker/p/2755488.html