Winform 窗体关闭,退出时判断是否为Windows系统关机

Winform 窗体关闭,退出时判断是否为Windows系统关机
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.WindowsShutDown)
            {
                MessageBox.Show("系统马上要关机了");
            }
        }


热门推荐