Form1_SizeChanged .....Maximize minimize events cannot capture

J

JJ

I have athe following code, but nothing happens when I minimize or maximze
the form using "top right corner minimze/maximize buttons". What am I
missing!!!!! Help please!!!!!!!!!!

Thanks
JJ



private void Form1_SizeChanged(object sender, System.EventArgs e)
{
if(this.WindowState == FormWindowState.Maximized)
{
MessageBox.Show("Maximized") ;
}
else if (this.WindowState == FormWindowState.Minimized)
{
MessageBox.Show("Minimized") ;
}
}
 
K

Kostya Ergin

try this:

private void WinForm_Resize(object sender, System.EventArgs e)
{
if(this.WindowState == FormWindowState.Maximized)
{
MessageBox.Show("Maximized") ;
}
else if (this.WindowState == FormWindowState.Minimized)
{
MessageBox.Show("Minimized") ;
}
}
 
T

Tim Wilson

Do you at least hit a breakpoint in the event handler if you set one? Are
you sure that you've registered with the event?

this.Resize += new System.EventHandler(this.Form1_Resize);

private void Form1_Resize(object sender, System.EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
MessageBox.Show("Maximized");
}
else if (this.WindowState == FormWindowState.Minimized)
{
MessageBox.Show("Minimized") ;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top