private void mw_Closing(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = true; if (pw.IsChecked == true) { //MessageBox.Show("确定"); if (pb.Password == "") { MessageBox.Show("请在密码框中输入你的密码", "警告"); } else { password pw = new password(); //新建实例对象 pw.ShowDialog(); } } else { System.Environment.Exit(0); } }