wpf创建时间
作者:互联网
1.wpf创建时间
DispatcherTimer dispatcherTimer = new DispatcherTimer();
// 当间隔时间过去时发生的事件
dispatcherTimer.Tick += new EventHandler(ShowCurrentTime);
dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1);
dispatcherTimer.Start();
public void ShowCurrentTime(object sender, EventArgs e)
{
//获得时分秒
this.tBlockTime.Text = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss");
}
标签:创建,ShowCurrentTime,时间,new,DispatcherTimer,wpf,dispatcherTimer 来源: https://blog.csdn.net/qq_44858151/article/details/113841982