In this article I will explain how to Minimize Windows Forms Application to System Tray and then Maximize it back to normal when the System Tray Icon is Double Clicked.
 
First Add Form Resize event to the Windows Form using the Properties Windows as shown below
Minimize Windows Forms Application to System Tray using C# and VB.Net

Then from the Toolbox add the NotifyIcon control to the Windows Form as shown in the screenshot below
Minimize Windows Forms Application to System Tray using C# and VB.Net

Then Right Click the NotifyIcon control and click Choose Icon and choose the Icon (.ICO) file for the application.
Minimize Windows Forms Application to System Tray using C# and VB.Net

Once all the above is done paste the following code
C#
private void Form1_Load(object sender, EventArgs e)
{
    notifyIcon1.BalloonTipText = "Application Minimized.";
    notifyIcon1.BalloonTipTitle = "ASPSnippets";
}
 
private void Form1_Resize(object sender, EventArgs e)
{
    if (WindowState == FormWindowState.Minimized)
    {
        ShowInTaskbar = false;
        notifyIcon1.Visible = true;
        notifyIcon1.ShowBalloonTip(1000);
    }
}
 
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
    ShowInTaskbar = true;
    notifyIcon1.Visible = false;
    WindowState = FormWindowState.Normal;
}
 
VB.Net
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    NotifyIcon1.BalloonTipText = "Application Minimized."
    NotifyIcon1.BalloonTipTitle = "ASPSnippets"
End Sub
 
Private Sub Form1_Reseize(sender As System.Object, e As System.EventArgs) Handles MyBase.Resize
    If WindowState = FormWindowState.Minimized Then
        ShowInTaskbar = False
        NotifyIcon1.Visible = True
        NotifyIcon1.ShowBalloonTip(1000)
    End If
End Sub
 
Private Sub NotifyIcon1_MouseDoubleClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
    ShowInTaskbar = True
    NotifyIcon1.Visible = False
    WindowState = FormWindowState.Normal
End Sub
 
 
Finally double click on the NotifyIcon control and paste the following code in the double click event
C#
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
    ShowInTaskbar = true;
    notifyIcon1.Visible = false;
    WindowState = FormWindowState.Normal;
}
 
VB.Net
Private Sub NotifyIcon1_MouseDoubleClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
    ShowInTaskbar = True
    NotifyIcon1.Visible = False
    WindowState = FormWindowState.Normal
End Sub
 
Minimize Windows Forms Application to System Tray using C# and VB.Net


Downloads
You can download the code in VB.Net and C# using the following download link below