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

Tray icon doesn't disappear after making it invisible

Bry
Sorry for the repost, but this has been driving me mad for the past few
days. There must be a simple solution.

There are many other posts about this problem upon an application exit,
but my problem is slightly different as my application does exit.......

I have a tray icon that wont disappear after calling

trayIcon.visible = false;

I have to move my mouse over the icon, and only then will it close. I'm
guessing the icon has actually gone, but the system tray just needs a
refresh.

Is there an easy way of doing this?

Nov 17 '05 #1
5 3377
"Bry" <br*********@gmail.com> wrote in
news:11*********************@g14g2000cwa.googlegro ups.com:
Sorry for the repost, but this has been driving me mad for the
past few days. There must be a simple solution.

There are many other posts about this problem upon an
application exit, but my problem is slightly different as my
application does exit.......

I have a tray icon that wont disappear after calling

trayIcon.visible = false;

I have to move my mouse over the icon, and only then will it
close. I'm guessing the icon has actually gone, but the system
tray just needs a refresh.

Is there an easy way of doing this?


Bry,

Are you exiting the app from w/i an IDE (i.e. by pressing the
IDE's "stop" button)? Or does this behavior happen when the app is
exited normally?
Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 17 '05 #2
Bry
Neither. The app is still running, all I want to do is make the tray
icon disappear, leaving the app still running.

The icon is set as invisible, but needs the user to hover over the icon
for it to disappear. Is there a way of getting the OS to refresh the
contents of the system tray?

Nov 17 '05 #3
"Bry" <br*********@gmail.com> wrote in
news:11**********************@g44g2000cwa.googlegr oups.com:
Neither. The app is still running, all I want to do is make the
tray icon disappear, leaving the app still running.

The icon is set as invisible, but needs the user to hover over
the icon for it to disappear. Is there a way of getting the OS
to refresh the contents of the system tray?


Bry,

I can't reproduce that behavior on my system:

.Net 1.1
VS.Net 2003
Windows XP SP2

I created a small WinForms test app with a button and a NotifyIcon.
I put this code in the button's click event handler:

private void button1_Click(object sender, System.EventArgs e)
{
this.notifyIcon1.Visible = !this.notifyIcon1.Visible;
}

The tray icon behaves as expected - appearing and disappearing each
time the button is pressed.

One thought that comes to mind is threading. Are you trying to make
the tray icon invisible from within a thread?

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 17 '05 #4
Bry
Ah-ha! Thanks Chris, I think you have found the problem. My application
does indeed use threading and I'm pretty sure that a worker thread is
setting the visible property.

Many Thanks.
Bry.

Nov 17 '05 #5
"Bry" <br*********@gmail.com> wrote in
news:11**********************@o13g2000cwo.googlegr oups.com:
Ah-ha! Thanks Chris, I think you have found the problem. My
application does indeed use threading and I'm pretty sure that a
worker thread is setting the visible property.


Bry,

You may already know this, but in order for a worker thread to update
a WinForms control, the thread has to be launched via the form's
Invoke (synchronous) or BeginInvoke (asynchronous) methods.
Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 17 '05 #6

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

Similar topics

10
by: Zeljko | last post by:
Hi, I have a form with a tray icon. However, when I minimize the form, it stays visible - not in the task bar (I have showintaskbar property set to false), but in a form of a rectangle sitting...
3
by: Mats-Lennart Hansson | last post by:
Hi, I'm having a hard time getting my service to show a sys tray icon. I've tried to create a separate Windows application where I simply add a notification icon to the form. In the OnStart method...
7
by: Danielb | last post by:
I want my application to run most of the time as just an notify icon visible in the system tray, with some dialogs windows that open if the user selects an option from the context menu on the tray...
4
by: utkarsh | last post by:
Hi, I want to develop a Window Service in C# that should be capable of sisplaying the a icon in the window tray. Based on some logic in service, icon should be changed to some other...
0
by: Bry | last post by:
I have a tray icon that wont disappear after calling trayIcon.visible = false; I have to move my mouse over the icon, and only then will it close. I'm guessing the icon has actually gone, but...
10
by: One Handed Man [ OHM ] | last post by:
If this is duplicated, I'm sorry because I cant find the original post I made today Anyway . . Now its my turn to ask a question I want to develop an app which will run in the system tray....
7
by: Benny Raymond | last post by:
I searched for a couple hours lastnight on example code of how to go about making an item in the System Tray (notification area) not be square. I've found several programs that do this but I can't...
3
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
3
by: Joseph Geretz | last post by:
The conventional approach is easy enough; drop a NotifyIcon onto a Form. When the form is loaded - bingo - the icon appears in the System Tray. I can't use this approach though. I'm writing a...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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...
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...

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.