close

image


image


image


加入參考 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: }


image






參考資料

1.https://youtu.be/3R9HsqwiiQI?t=3017

arrow
arrow
    全站熱搜

    me1237guy 發表在 痞客邦 留言(0) 人氣()