Solved

How to minimize my windows form to system tray?

Posted on 2008-09-30
2
1,027 Views
Last Modified: 2012-05-05
How to minimize my windows form to system tray?

I have a standalone application developed in Dot net 3.0. When the Minimize button is pressed (it is in running mode), it should automatically go to system tray (it should run in back ground and icon should be there in system tray) and when the user clicks on the icon in system tray, it should display its Main Form. How to achieve this? Can anyone supply me the code for this?
0
Comment
Question by:GouthamAnand
2 Comments
 
LVL 15

Accepted Solution

by:
angus_young_acdc earned 500 total points
ID: 22603340
Add a NotifyIcon to your form. Set the default Visible property to be false.

Add a Form_Resize event handler to the form.

private void Form1_Resize(object sender, System.EventArgs e)
{
      if(this.WindowState == FormWindowState.Minimized)
      {
            this.Visible = false;
            notifyIcon1.Visible = true;
      }
}

Then add an event handler to the NotifyIcon (usually double click) with this code:

this.Visible = true;
notifyIcon1.Visible = false;

And the following sites should help:
http://www.codeguru.com/Csharp/.NET/net_general/tipstricks/article.php/c6933/
http://www.developer.com/net/csharp/article.php/3336751
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp06102002.asp

Credit to EE for the above.
0
 

Author Closing Comment

by:GouthamAnand
ID: 31501476
Thank you..
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now