I know this question is quite old, but it works as follows:
public Form1() { InitializeComponent(); this.SizeChanged += new EventHandler(Form1_WindowStateTrigger); } private void Form1_WindowStateTrigger(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { MessageBox.Show("FORM1 MINIMIZED!"); } if (this.WindowState == FormWindowState.Normal) { MessageBox.Show("FORM1 RESTORED!"); } if (this.WindowState == FormWindowState.Maximized) { MessageBox.Show("FORM1 MAXIMIZED!"); } }
Using the SizeChanged event in conjunction with WindowState validation does the trick here.
Redhart
source share