I want to hide my application in system tray when I click the Form Closing
button(clasic red X button). I provided with this code;
private void Ana_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
this.Hide();
}
So, the application is stil running in the system tray
. I have added a ContextMenuStrip
and when I right click on mouse ContextMenuStrip
a Close
button comes up but when I click that Close
button the application is still running.
I want to terminate the application when I click that Close
button. Here is my code:
private void kapatToolStripMenuItem_Click(object sender, EventArgs e) //Close
{
DialogResult ext;
ext = MessageBox.Show("Çıkmak İstediğinizden Emin misiniz?", "Onay", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ext == DialogResult.Yes)
{
Application.Exit();
}
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
}