?
Solved

Minimise to System Tray not Taskbar as well.

Posted on 2006-04-03
6
Medium Priority
?
213 Views
Last Modified: 2010-04-16
Warning, c# N00b :-)

I'd like to minimise my app to the system tray, rather than the taskbar.
I've created a NotifyIcon and used the following code to hide the app from the taskbar:

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

The app when minimised goes to the system tray just fine but I still have the app on the taskbar too.
Everywhere I've hunted seems to show the same code to what I've already quoted - Am I missing something obvious?
Thanks,

- M.
0
Comment
Question by:nikez2k4
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:e1v
ID: 16358926
You can set this.ShowInTaskbar = false
0
 
LVL 1

Author Comment

by:nikez2k4
ID: 16359000
Thanks for the reply... set it in .. here, or elsewhere?

        private void Form1_Resize(object sender, System.EventArgs e)
        {
            if (FormWindowState.Minimized == WindowState)
                Hide();
           
        }
0
 
LVL 6

Expert Comment

by:e1v
ID: 16359081
Hello, you could set ShowInTaskbar false when WindowState == Minimized and true when its not minimized.

But it shouldn't be necessary setting it at all... When I tried your Resize-method my program dissapeared form the taskbar just fine.
So there must be something else going on.
0
 
LVL 1

Author Comment

by:nikez2k4
ID: 16359370
Went with this, which seems to work (not sure why the other one didnt)

-
  private void Form1_Resize(object sender, System.EventArgs e)
        {
            //Check to see if the window has been Minimized:
            if (this.WindowState == FormWindowState.Minimized)
            {
                //Remove the Program from the Task Bar:
                this.ShowInTaskbar = false;
                //Show the Icon in the system tray:
                notifyIcon1.Visible = true;
            }
-
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16637268
PAQed with points refunded (250)

GranMod
Community Support Moderator
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

850 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