By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,994 Members | 1,080 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,994 IT Pros & Developers. It's quick & easy.

How do I catch the event that happen when the minimize icon is clicked

P: n/a
Hello!

I have a mainManu where I can chose to display some window forms.
When the mainMenu is minimized I need to minimize every window form that is
started from the mainMenu.
So I need to catch the event that is trigged when the little underscore(the
minimize icon) up to the right is clicked.

I need to catch this event because all my child window forms must also be
minimized

I can't find any suitable method that I can use.

Is it possible to do it in another way then catch minimize event.

//Tony
May 12 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
tony wrote:
Hello!

I have a mainManu where I can chose to display some window forms.
When the mainMenu is minimized I need to minimize every window form that
is started from the mainMenu.
So I need to catch the event that is trigged when the little
underscore(the minimize icon) up to the right is clicked.

I need to catch this event because all my child window forms must also be
minimized

I can't find any suitable method that I can use.

Is it possible to do it in another way then catch minimize event.


You can override OnSizeChanged and query the forms WindowState. Ex:

protected override void OnSizeChanged(EventArgs e)
{
switch (this.WindowState)
{
case FormWindowState.Minimized:
// minimize my other forms
break;
case FormWindowState.Maximized:
case FormWindowState.Normal:
// only put code here if there is a requirement to do something
(do you need to restore minimized forms?)
break;
default:
break;
}

// Don't forget to call base
base.OnSizeChanged (e);
}

If this is a requirement, have you considered making your app MDI?
--
Tom Porterfield

May 12 '06 #2

P: n/a
Hello!!

Thanks for your answer. I want to ask one more thing about this.

I have one mainMenu and then I display some window form by chosing some from
the menu.
We can assume that the window forms chosen from the menu is called A and B.
When the main Menu is minimized window form A and B is also minimized that's
what I wanted. That works fine.

Now to my question : When the mainMenu is displayed again so to speak back
to normal state window form A and B should also be displayed.
How can that be dome?

//Tony
"Tom Porterfield" <tp******@mvps.org> skrev i meddelandet
news:eY**************@TK2MSFTNGP02.phx.gbl...
tony wrote:
Hello!

I have a mainManu where I can chose to display some window forms.
When the mainMenu is minimized I need to minimize every window form that
is started from the mainMenu.
So I need to catch the event that is trigged when the little
underscore(the minimize icon) up to the right is clicked.

I need to catch this event because all my child window forms must also be minimized

I can't find any suitable method that I can use.

Is it possible to do it in another way then catch minimize event.
You can override OnSizeChanged and query the forms WindowState. Ex:

protected override void OnSizeChanged(EventArgs e)
{
switch (this.WindowState)
{
case FormWindowState.Minimized:
// minimize my other forms
break;
case FormWindowState.Maximized:
case FormWindowState.Normal:
// only put code here if there is a requirement to do

something (do you need to restore minimized forms?)
break;
default:
break;
}

// Don't forget to call base
base.OnSizeChanged (e);
}

If this is a requirement, have you considered making your app MDI?
--
Tom Porterfield

May 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.