#region Close the form hidden to the tray
private void menu_FormClosing(object sender, FormClosingEventArgs e)
{
//Notice that the Reason for the close event comes from the form button, otherwise you cannot exit when you exit with the menu!
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true; //Cancel the closed Window event
this.WindowState = FormWindowState.Minimized; //Causes the window to shrink towards the lower right corner when closed
notifyIcon1.Visible = true;
this.Hide();
return;
}
}
#endregion