Creating an app that can minimize to the tray

So for a long time I've wanted to create an app that can minimize to the system tray. MFC could do it but you had to call some compilcated win32 routines. I've found .net 2.0 makes this easy! Yay for .net. What you need to do is add a NotifyIcon control to your application. This will display an icon in the system tray with an icon of your choice. For my app I simply set the initial Visible property to false so you can't see the icon and then when the user minimizes the application I set the main forms ShowInTaskbar property to false and set the NotifyIcon Visible propety to true. And instantly you get no app and an icon in the taskbar. To get it back add a DoubleClick event to the NotifyIcon and restore the main form. Now users can minimize my app to the tray and double click it to get it back.

The program is done and is now ready for download at


Link to the site

Comments

Popular posts from this blog

String.Replace vs Regex.Replace

C# Form Application in Kiosk Mode/Fullscreen

C# using a transaction with ODBC