Solved

How to minimize my windows form to system tray?

Posted on 2008-09-30
2
1,045 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Part One of the two-part Q&A series with MalwareTech.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

628 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