Solved

Change tray icon or tray color WInForm

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to repeat the data 4 43
VB/ASP.Net "Value of type 'Date' cannot be converted to 'Integer'" 12 58
How to set focus on a dynamic control 18 48
Shared Service Environment 2 54
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…

737 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