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 PaintingPC { public partial class FrmPassWord : Form { public event Action OkBtnClick; public FrmPassWord() { InitializeComponent(); } private void btnOk_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtPass.Text)) { MessageBox.Show("请输入密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPass.Focus(); return; } if (OkBtnClick != null) { OkBtnClick(txtPass.Text); } } private void btnCancel_Click(object sender, EventArgs e) { OkBtnClick(""); this.Close(); } } }