AsadChohan
AsadChohan

Reputation:

How to minimiz a Form to Sys Tray on Closing Event in .NET

How to minimize a Form to System Tray on Closing Event in .NET

Please HELP.....

Upvotes: 0

Views: 123

Answers (1)

jgottula
jgottula

Reputation: 1366

Add a NotifyIcon control to the form and an event handler for FormClosing:

private void Form1_FormClosing(Object sender, FormClosingEventArgs e)
{
    if (e.CloseReason == CloseReason.UserClosing)
    {
        e.Cancel = true;
        this.Visible = false;
        this.notifyIcon1.Visible = true;
    }
}

Upvotes: 6

Related Questions