.Net ramblings
# Monday, 12 July 2004
System tray icons in Windows forms apps

If you add a NotifyIcon (system tray icon) to a Windows forms application, you will need to modify the dispose event of the form containing the icon, to explicitly call dispose on the notifyIcon as follows:

protected override void Dispose( bool disposing )
{
 if( disposing )
 {
  this.notifyIcon1.Dispose();
  if (components != null)
  {
   components.Dispose();
  }
 }
 base.Dispose( disposing );
}

if you don't do this, the icon will get left in the system tray after the application quits, until you move the mouse over the icon and then it will disappear.


Monday, 12 July 2004 10:02:42 (GMT Daylight Time, UTC+01:00)  #    Comments [0]  .Net Windows Forms

OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview