Solved

Change tray icon or tray color WInForm

Posted on 2011-09-22
2
634 Views
Last Modified: 2013-11-27
I have my (first) WinForm that loads in the tray and shows an icon

How can I make it swap out the icon (or just change color) based on an event?
For development purposes, maybe just have it cycle colors every 20 seconds?
0
Comment
Question by:lrbrister
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 36582364
Add a Timer to your Form and set its Interval property to the time you want (in milliseconds, so 20000 for 20 seconds).

Supporsing that your icons are in the application resources, program the Tick event of the timer this way:
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick

   Static flag As Boolean

   If flag Then
      flag = False
      NotifyIcon1.Icon = My.Resources.Icon1
   Else
      flag = True
      NotifyIcon1.Icon = My.Resources.Icon2
   End If

End Sub

Open in new window

0
 

Author Closing Comment

by:lrbrister
ID: 36600636
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

920 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

13 Experts available now in Live!

Get 1:1 Help Now