private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) //退出菜单方法 { //this.Close(); Application.Exit();//建议使用该关闭语句 } private void timer1_Tick(object sender, EventArgs e) //时间方法 { toolStripStatusLabel1.Text = DateTime.Now.ToString(); } private void Form1_Resize(object sender, EventArgs e)//窗口最大最小改变后产生的效果 { if (this.WindowState == FormWindowState.Minimized) { notifyIcon1.Visible = true; this.Visible = false; } else { notifyIcon1.Visible = false; this.Visible = true; } } private void Form1_Load(object sender, EventArgs e) { //if (this.WindowState == FormWindowState.Minimized) //{ // ShowInTaskbar = false; //} } //private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e) //{ // this.Visible = true; // this.WindowState = FormWindowState.Normal; //} private void notifyIcon1_DoubleClick(object sender, EventArgs e) //右下角小图标相关设定 { this.Visible = true; this.WindowState = FormWindowState.Normal; } private void 显示ToolStripMenuItem_Click(object sender, EventArgs e) //双击右下角图标显示程序窗口 { notifyIcon1_DoubleClick(sender, e); }