Handle minimized, maximized, restore event of Form in c#

You can do this with the help of Form sizechanged event.

 

        public Form1()

        {   InitializeComponent();

            this.SizeChanged += new EventHandler(form1_sizeeventhandler);

        }

 

 

        private void form1_sizeeventhandler(object sender, EventArgs e)

        {

            if (this.WindowState == FormWindowState.Minimized)

            {

                MessageBox.Show("Form is mininized");

                // handle it

            }

            if (this.WindowState == FormWindowState.Normal)

            {

                MessageBox.Show("Form is restored");

                // handle it

            }

 

            if (this.WindowState == FormWindowState.Maximized)

            {

                MessageBox.Show("Form is maximized");

                // handle it

            }

        }