摘要: 先说一个类似的方法: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. 阅读全文
posted @ 2012-06-22 13:18 洗耳恭听兼烂笔头 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2012-06-22 09:47 洗耳恭听兼烂笔头 阅读(515) 评论(0) 推荐(1) 编辑