//二 双击窗体上的菜单项,添加相关代码
private void exitMenuItem_Click(object sender, EventArgs e)
{
if (MessageBox.Show("你确定要退出程序吗?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
{
notifyIcon1.Visible = false;
this.Close();
this.Dispose();
Application.Exit();
}
}
private void hideMenuItem_Click(object sender, EventArgs e)
{
this.Hide();
}
private void showMenuItem_Click(object sender, EventArgs e)
{
this.Show();
this.WindowState = FormWindowState.Normal;
this.Activate();
}