我的需求是,按"Enter"键就出发"插卡"这个按钮.
请问怎么做哈?
我这样做:
private void Form1_KeyPress(object sender, KeyPressEventArgs e) {
if (e.KeyChar == 13) {
this.ActiveControl = btnInsertCard;
}
} //插卡.这样得是得,但是有个问题.
第一次我按"Enter"键的时候,"插卡"键被聚焦(即按钮键四周有轮廓).
当我再按的时候,才出发"插卡"按钮事件.请问我怎么做哈?
请问怎么做哈?
我这样做:
private void Form1_KeyPress(object sender, KeyPressEventArgs e) {
if (e.KeyChar == 13) {
this.ActiveControl = btnInsertCard;
}
} //插卡.这样得是得,但是有个问题.
第一次我按"Enter"键的时候,"插卡"键被聚焦(即按钮键四周有轮廓).
当我再按的时候,才出发"插卡"按钮事件.请问我怎么做哈?
if (e.KeyChar == 13) {
this.ActiveControl = btnInsertCard;
btnInsertCard.PreformClick();
}
}
this.Button1_Click(Button1, new EventArgs());
this.AcceptButton = btnInsertCard;