摘要:
先说一个类似的方法:KeyPress private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar.ToString() == "\r"){//按回车的时候处理}if(e.KeyChar<'a' || e.KeyChar>'z') { e.Handled=true; } } 或者: private void textBox1_KeyPress(object sender, System. 阅读全文
摘要:
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (bl == false) { DialogResult dr = MessageBox.Show("不需要保存吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { Application.Exit(); } else { e.Cancel = true; } } el 阅读全文