1.组件的应用
组件, 添加但不可直接显示在窗体上的控件
1.1 Timer闹钟
放一个Label和一个Timer
1 private void Form1_Load(object sender, EventArgs e) 2 { 3 this.timer1.Interval = 500; //单位ms 4 this.timer1.Start(); 5 label1.Text = DateTime.Now.ToString(); 6 } 7 8 private void timer1_Tick(object sender, EventArgs e) 9 { 10 DateTime time = DateTime.Now; 11 this.label1.Text = time.ToString(); 12 if (time.Hour == 8 && time.Minute == 1 && time.Second == 1) 13 MessageBox.Show("起床啦!!"); 14 }
1.2 ImageList 组件
时间: 2024-10-19 10:55:19