1. 程式人生 > >C#winfrom 窗體最小化事件

C#winfrom 窗體最小化事件

     private void Form1_SizeChanged(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)
            {
               
                this.Opacity = 0;//設定窗體隱藏,0為隱藏
            }

        }

        private void Form1_Load(object sender, EventArgs e)
        {    this.SizeChanged += new System.EventHandler(this.Form1_SizeChanged);

        }

   private void button1_Click(object sender, EventArgs e)顯示窗體
        {
          this.WindowState = FormWindowState.Normal;
            this.Opacity = 1;
        }