using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LLMF { public partial class frmPassword : Form { string password; public bool isOK1 = false; public bool isOK { get { return isOK1; } } public frmPassword(string password) { InitializeComponent(); this.password = password; } private void button1_Click(object sender, EventArgs e) { if (txtPassword.Text.Equals(this.password)) { isOK1 = true; this.Close(); } else { MessageBox.Show("密码错误!!"); this.txtPassword.Text = ""; } } private void txtPassword_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { if (txtPassword.Text.Equals(this.password)) { isOK1 = true; this.Close(); } else { MessageBox.Show("密码错误!!"); this.txtPassword.Text = ""; } } } } }