|
|
1
5
是否有定义为默认操作的按钮? 如果是这样,则该控件将吞食Enter键。 也许这就是你的答案。您需要在提交按钮上将DefaultAction属性设置为true。 |
|
2
0
改为尝试keydown事件。
|
|
|
3
0
也许您应该使用表单的“acceptButton”将其设置为提交按钮。你认为这就是你真正的… |
|
|
4
0
你漏掉了一点至关重要的东西,你必须
void tbPassword_KeyPress(object sender, KeyPressEventArgs e)
{
MessageBox.Show(e.KeyChar.ToString());
if (e.KeyCode == Keys.Enter){
// This is handled and will be removed from Windows message pump
e.Handled = true;
}
}
|
|
|
5
0
试试这个
|
|
|
6
0
转到表单… 在基本形式上改变这个 formName.acceptButton=按钮名; 这将读取Enter的密钥日志文件…自动.. 如果不希望用户看到“接受”按钮,可以这样做。 buttonname.visible=false; formName.acceptButton=按钮名; AcceptButton自动从键盘读取Enter键 |