Form Closing
当我单击按钮(经典红色 X 按钮)时,我想将我的应用程序隐藏在系统托盘中。我提供了此代码;
private void Ana_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
this.Hide();
}
因此,该应用程序仍在system tray
. 我添加了一个ContextMenuStrip
,当我右键单击鼠标时会出现ContextMenuStrip
一个Close
按钮,但是当我单击该Close
按钮时,应用程序仍在运行。Close
单击该按钮时,我想终止应用程序。这是我的代码:
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();
}