private void richTextBox1_KeyPress(object sender, KeyPressEventArgs e) { char[] chars = new char[] { (char)13, (char)8, (char)42, (char)46, (char)47 }; //回车 Backspace键 *键 .键 /键 if (!(char.IsNumber(e.KeyChar)) && !chars.Contains(e.KeyChar)) { e.Handled = true; } }