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