473,394 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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
2 5059
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David Rose | last post by:
I would like to catch the tab change before it occurs. There is a SelectedIndexChanged event to catch the change after it occurs. How do I catch when the user clicks on a tab, but before the...
3
by: Jim | last post by:
Hi, I intend to set the form Visibility to false and show a taskbar icon instead. I've done this on the FormClosing event but I want this to happen when the form is minized too. How do I...
1
by: Ignacio X. Domínguez | last post by:
Hi everyone. Hope you can help me out on this one. I'm developing a Component which has a property ContextMenu. This component, when placed on a form with a working ContextMenu (events assigned...
6
by: ALI-R | last post by:
What is the difference between implementing an Event using a Deligate or an Event Handler?,look at below 1)this.button1.Click += new System.EventHandler(this.button1_Click); ..................
0
by: Latha Rajeev | last post by:
Hello, I have an aspx page, and i want to trap the window minimize event(clicking the minimize button in the title bar of window) in my client side javascript code. I thought that the window...
4
by: iwdu15 | last post by:
hi, how can i catch when the user clicks the minimize button on the form and do a certain event then? what im looking to do is when the user minimizes the form, to put the form on the system tray....
8
by: Terry Olsen | last post by:
I want to minimize my program to the tray when minimized. But there's no "minimize" event. So how can I catch this event and use it?
9
by: jeff | last post by:
New VB user...developer... Situation...simplified... - I want to wrap a pre and post event around a system generated where the pre-event will always execute before the system event and the...
2
by: deciacco | last post by:
I have a NotifyIcon application. (c# 2) I want to be able to catch a kill/shutdown attempt so that I can call Dispose() to remove the icon. I tried to create an event handler for ApplicationExit...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.