加入參考 using System.Windows.Threading;
+= 按下Tab鍵兩次,自動貼出Event程式碼
1: public partial class MainWindow : Window
2: {3: public MainWindow()
4: { 5: InitializeComponent();6: DispatcherTimer timer = new DispatcherTimer();
7: timer.Interval = TimeSpan.FromSeconds(1); 8: timer.Tick += Timer_Tick; 9: timer.Start(); 10: } 11: 12: private void Timer_Tick(object sender, EventArgs e)
13: {14: this.timeTBox.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
15: } 16: }參考資料
文章標籤
全站熱搜
