private void button1_Click(object sender, RoutedEventArgs e)
{
if (textBox1.Text == "123")
{
Application.Current.MainWindow.Close();
}
else
{
string message = "请输入密码,然后再退出窗体...";
MessageBox.Show(message, "温馨提示你", MessageBoxButton.OK);
textBox1.Focus();
}
}
温馨提示:答案为网友推荐,仅供参考