当前位置:网站首页>C WinForm [display real-time time in the status bar] - practical exercise 1

C WinForm [display real-time time in the status bar] - practical exercise 1

2022-07-05 07:55:00 BoomBiuBiu

1、 Drag two controls from the toolbox to the form ----timer Controls and statusStrip Control

2、 Select the properties of the status bar ---- Click on Items---- Add item ---- hold Text Display date and time instead

3、 choice Timer attribute , hold Enabled Change it to 【True】,Interval Change it to 【1000】

 4、 Click event ---- stay Tick Press enter

 5、 Enter the code

 private void timer1_Tick(object sender, EventArgs e)
 {
     toolStripStatusLabel7.Text = System.DateTime.Now.ToString();
 }

 6、 Results show

原网站

版权声明
本文为[BoomBiuBiu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140548303033.html