using ProjectManagementSystem.Enterance; using System.Diagnostics; using System.Windows.Forms; namespace ProjectManagementSystem { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private void MainForm_Load(object sender, System.EventArgs e) { WindowState = FormWindowState.Minimized; ShowInTaskbar = false; SystemEnterance systemEnterance = new SystemEnterance(); } private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; WindowState = FormWindowState.Minimized; ShowInTaskbar = false; } private void 关闭系统ToolStripMenuItem_Click(object sender, System.EventArgs e) { Process[] process = Process.GetProcesses(); Process currentProcess = Process.GetCurrentProcess(); for (int i = 0; i < process.Length; i++) { if (process[i].ProcessName == currentProcess.ProcessName) { process[i].Kill(); } } Dispose(); Close(); } private void notifyIcon1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { contextMenuStrip1.Location = new System.Drawing.Point(MousePosition.X, MousePosition.Y); contextMenuStrip1.Show(); } } } }