private void Form1_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized)//最小化到系统托盘 { notifyIcon1.Visible = true;//显示托盘图标 this.Hide();//隐藏窗口 } } private void notifyIcon1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.Show(); WindowState = FormWindowState.Normal; this.Focus(); } } private void label_min_Click(object sender, EventArgs e) { this.WindowState = FormWindowState.Minimized; } private void label_close_Click(object sender, EventArgs e) { this.WindowState = FormWindowState.Minimized;//使关闭时窗口向右下角缩小的效果 }