Solved

Change tray icon or tray color WInForm

Posted on 2011-09-22
2
624 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

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

Title # Comments Views Activity
SAPE.heur.AE935 Visual Studio 3 18
Where to begin studying? 5 66
Format column on datatable 7 18
Visual Studio editor? 1 18
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
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:…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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