This won't be terribly in-depth, but I spent a large amount of time figuring this out today, so I hope this is useful to someone.
Assuming you have a single form and a NotifyIcon control created, you'll need to trap the Resize event for the form. This even it fired any time the form is resized, but also when the form's WindowState property changes. In this subroutine, you'll want to detect when WindowState is minimized. If it is, set the form's ShowinToolbar property to False and the NotifyIcon to visible. Otherwise, set the NotifyIcon to hidden and the form's ShowInToolbar property to visible.
The only other trick is to trap the NotifyIcon's DoubleClick event to set ShowInToolbar to true and the NotifyIcon to hidden.
I would love to just post the code for everyone, but you know how it is.