1. 程式人生 > >C 處理窗體的最小化事件及恢復正常窗體事件

C 處理窗體的最小化事件及恢復正常窗體事件

               

最近因為我的一個小軟體需要處理窗體最小化事件及窗體從最小化恢復到正常狀態時的事件,

所以上網查了下,原來是通過處理窗體的Resize事件來實現的,我實現該工能時的主要程式碼如下:

 //窗體大小發生變化時         private void FormMain_Resize(object sender, EventArgs e)        {            //窗體最小化時            if(this.WindowState==FormWindowState.Minimized)            {                //停止定時器                this
.timerA.Stop();                this.timerB.Stop();                this.timerC.Stop();                this.timerD.Stop();            }            //窗體恢復正常時            if (this.WindowState==FormWindowState.Normal)            {                //啟動定時器                this.timerA.Start();                this.timerB.Start();                this
.timerC.Start();                this.timerD.Start();            }        }