Solved

Animate notify icon

Posted on 2003-11-15
5
2,466 Views
Last Modified: 2007-12-19
I have windows form with notify icon. On certain event I want the Icon to animate till user click on it. Then message box should display the message and notify icon should stop animation.
How can I do it?
0
Comment
Question by:glowas
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
Joeisanerd earned 500 total points
ID: 9756917
Create as many icons as you need for the animation in code.
Icon Icon1 = new Icon("icon1.ico");
Icon Icon2 = new Icon("icon2.ico");

Add the notifyIcon to the form, also add a timer
Write an event for the timer so that when it goes off you change the currently displayed icon in notifiyIcon like this.

if( notifyIcon1.Icon == Icon1 )
    notifyIcon1.Icon = Icon2;
else
   notifyIcon1.Icon = Icon1;

This way the icons will switch back and forth whenever the timer goes off. If you want the animation to stop then stop the timer and set the icon to what icon you want.

Just write the mouse click event for the notifyIcon and on that event stop the timer, change icons, display message.
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 9758110
Note: Make sure you're using Windows.Forms.Timer (There are 3 timer implementations with different behaviour)
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9758994
Can you use a static GIF and an animated GIF and switch between the two as necessary?  You would avoid the need to have lots of .ico files then.
0
 
LVL 9

Expert Comment

by:Joeisanerd
ID: 9759022
No you can't use gifs, there icons.  You could however put the icons in a resource file and load the icons from the resource file.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9759232
Never mind, it was just a thought ;-)
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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

911 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

18 Experts available now in Live!

Get 1:1 Help Now