Moelijker dan dit is het niet:
[cpp] //Als er wél afgesloten moet worden, zorg dan dat shutDown de waarde 'true' heeft.
private bool shutDown = false;
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = !shutDown;
if (!shutDown)
{
//this.ShowInTaskbar = false; //Mocht dit nog niet zijn ingesteld
//notifyIcon.Icon = this.Icon //Zorg ook dat het notifyIcon-component in ieder geval een Icon heeft.
notifyIcon1.Visible = true;
this.Hide();
}
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
notifyIcon1.Visible = false;
}[/cpp]