1

I have a problem. I need to add winform into tray. For example I want to add clock in the tray, to do this I have to add a small winform in the system tray, which will display the time and also will have a small context menu to edit settings etc.

How can I add this form in the system tray? (I tried to search in the internet for any ideas, resolves but anyway I dont have any good idea how to implement this on C#)

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Daniel
  • 635
  • 1
  • 5
  • 22
  • Thanks for advices, but it isn't exactly what I want... I need to add FORM into tray... Or... How I will draw clock etc on notify icon? So... The form must be situated in the system tray and on THIS form I will draw clock, which will be working and showing time and other things. – Daniel May 21 '12 at 17:58

3 Answers3

2

You can use the NotifyIcon object and handle the form resize event to hide the form and display the NotifyIcon. See http://alperguc.blogspot.com/2008/11/c-system-tray-minimize-to-tray-with.html and minimize app to system tray.

Community
  • 1
  • 1
Josh
  • 2,955
  • 1
  • 19
  • 28
2

Windows supports adding icons into the tray, whose official name is the notification area. It does not support adding anything else there, so your idea of adding a WinForm is simply not viable.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Are you serious? So... There are no any variant exists to do my task? – Daniel May 21 '12 at 18:07
  • Yes I am serious. The notification area displays square icons. No other options. One possible option are [deskbands](http://msdn.microsoft.com/en-us/library/windows/desktop/aa511446.aspx#deskbands) but MS are telling you not to use those. This may not be what you want to hear, but that doesn't make it any less true I'm afraid. – David Heffernan May 21 '12 at 18:14
1

Check out the Windows Forms NotifyIcon control.

Specifies a component that creates an icon in the notification area.

Check out the description and sample on MSDN - NotifyIcon Class.

Community
  • 1
  • 1
dknaack
  • 60,192
  • 27
  • 155
  • 202