473,387 Members | 1,347 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,387 software developers and data experts.

Minimize override?

I would like to override the behavior of my applications Minimize button to
Hide() but can't seem to locate where Minimize is implemented in the
framework. The closest I've found is a property where one can toggle
between the application going to the tray or to the desktop but I just want
it to be restorable from its notification icon and nowhere else.

Nov 15 '05 #1
2 4424
Hi,

I copied the below straight from the MSDN documentation for the
From.MinimzeBox property.

Note Minimizing a form at run time generates a Resize event. The
WindowState property reflects the current state of the window. If you set
the WindowState property to FormWindowState.Minimized, the form is minimized
independently of whatever settings are in effect for the MinimizeBox and
FormBorderStyle properties.

In side the Resize event you could perform any actions needed.

Hope this helps.
--
Glen Jones MCSD

"T250" <no**@nowhere.com> wrote in message
news:Xn****************************@129.250.170.83 ...
I would like to override the behavior of my applications Minimize button to Hide() but can't seem to locate where Minimize is implemented in the
framework. The closest I've found is a property where one can toggle
between the application going to the tray or to the desktop but I just want it to be restorable from its notification icon and nowhere else.

Nov 15 '05 #2
"Glen Jones MCSD" <gl********@mailhot.com> wrote in
news:H8********************@comcast.com:
Hi,

I copied the below straight from the MSDN documentation for the
From.MinimzeBox property.

Note Minimizing a form at run time generates a Resize event. The
WindowState property reflects the current state of the window. If you
set the WindowState property to FormWindowState.Minimized, the form is
minimized independently of whatever settings are in effect for the
MinimizeBox and FormBorderStyle properties.

In side the Resize event you could perform any actions needed.

Hope this helps.


As it turns out setting FormWindowState.Minimized led to some anomalous
behaviour when going from Maximized window to Normal (the client area
would disappear). Instead of "setting" I tested for the minimized
window state within my Resize method and all is well.

private void WinForm_Resize(object sender, System.EventArgs e)
{
FormWindowState CurrentWindowState = WindowState;
if(CurrentWindowState == FormWindowState.Minimized)
{
Hide();
}
else
{
Show();
}
}

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: kurotsuke | last post by:
How can I hide a Form (instead of having it reduced to the taskbar) when the minimize button is pressed in C# (there's an icon in the tray bar)? I added the code protected override void...
7
by: Amir V | last post by:
hi, i would like to know when the user minimized the window, how can i do it ? Thanks T :-)
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?
2
by: tony | last post by:
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...
1
by: zakhirn | last post by:
Anyone have code that creates a button that will Minimize Excel to the system tray. I do not need anything complicated like changing the minimize button or the close button to a minimize to...
3
by: Jimmy | last post by:
I'm kinda newbie to python and wxPython. Now I'm confronting a thorny problem: how can I make my program minimize to the taskbar represented as an ico, and when there is some message from network...
5
by: Rinaldo | last post by:
Hi, How to regonize when the user clicks the minimize button in a form with events? Rinaldo
5
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Dear all, I'd like to know if there is any method to minimize command mode window when a console program is running. In my case, there are several console programs which run periodically in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.