What's the proper way to minimize to tray a C# WinForms app?
Solution 1:
There is actually no managed way to do that form of animation to the tray in native winforms, however you can P/Invoke shell32.dll to do it:
Some good info here (In the comments not the post):
http://blogs.msdn.com/jfoscoding/archive/2005/10/20/483300.aspx
And here it is in C++:
http://www.codeproject.com/KB/shell/minimizetotray.aspx
You can use that to figure out what stuff to Pinvoke for your C# version.
Solution 2:
this.WindowState = FormWindowState.Minimized
That is the built in way to do it and it looks fine to me most of the time. The only time is has some weirdness to it is if you call it on startup which has some weirdness sometimes which is why most people will also set the ShowInTaskbar = false and hide the form too.
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.windowstate.aspx