这是:
http://msdn.microsoft.com/en-us/library/system.windows.forms. Control.keypress.aspx
...indicates that I should have access to e.KeyCode in the KeyPress event, but I don t seem to. I m trying to allow only 1,2,3, and backspace:
private void textBoxQH1_KeyPress(object sender, KeyPressEventArgs e) {
if ((e.KeyChar != 1 ) &&
(e.KeyChar != 2 ) &&
(e.KeyChar != 3 ) &&
(e.KeyChar != (Keys.Back))) {
e.Handled = true;
}
}
......但“......”没有像例子所示显示的“KeyCode”价值,也没有用钥匙审判Char。 后面的老板,“主人!”不能适用于类型的果园和系统。 Windows.Forms.Keys “
因此,我如何能够做到这一点?