C#处理窗体的最小化事件及恢复正常窗体事件
最近因为我的一个小软件需要处理窗体最小化事件及窗体从最小化恢复到正常状态时的事件,
所以上网查了下,原来是通过处理窗体的Resize事件来实现的,我实现该工能时的主要代码如下:
1 //窗体大小发生变化时 2 private void FormMain_Resize(object sender, EventArgs e) 3 { 4 //窗体最小化时 5 if(this.WindowState==FormWindowState.Minimized) 6 { 7 //停止定时器 8 this.timerA.Stop(); 9 this.timerB.Stop(); 10 this.timerC.Stop(); 11 this.timerD.Stop(); 12 } 13 14 //窗体恢复正常时 15 if (this.WindowState==FormWindowState.Normal) 16 { 17 //启动定时器 18 this.timerA.Start(); 19 this.timerB.Start(); 20 this.timerC.Start(); 21 this.timerD.Start(); 22 } 23 }
探索代码的奥秘,享受技术的乐趣-_-!...