Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi all

 

i want when my window form get closed it shud place a icon on the system tray .. can anyone tell me how to do it ... and also how to add the menu when the user right click at the icon ...

 

i dont want it to display on the taskbar but as a icon in the system tray

Posted (edited)
hi all

 

i want when my window form get closed it shud place a icon on the system tray .. can anyone tell me how to do it ... and also how to add the menu when the user right click at the icon ...

 

i dont want it to display on the taskbar but as a icon in the system tray

 

Hi

 

For the systemtray icon, use the NotifyIcon control, and set the visibility property to false if you don't want the icon to be in the system tray at all times.

In the form_Closing event of your form, put code something along the lines of:

       e.Cancel = True
       Me.Hide()
       NotifyIcon.Visible = True

 

This will hide the form, and make the sys tray icon visible.

 

As for the menu, look at the ContextMenu control - create the menu and remember to add it to the system tray icon (by using the NotifyIcon's ContextMenu property ;)

 

Hope this helps :)

Edited by 3xodus

Using: Visual Studio 2005/08

Languages: C#, Win32 C++, Java, PHP

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...