如何在输入为选项卡时打开新表单

本文关键字:新表单 表单 输入 选项 | 更新日期: 2023-09-27 17:57:10

当我按下Enter按钮时,它在form1_keydown事件中使用此代码Tab

 Control nextControl; 
 if (e.KeyCode == Keys.Enter)
 {
 nextControl = GetNextControl(ActiveControl, !e.Shift);
 nextControl.Focus();
 e.SuppressKeyPress = true;
 }

表格中有comboBox,我们按下Enter按钮然后打开New Form .
怎么做,因为它不适用于cmb_KeyPress事件

如何在输入为选项卡时打开新表单

在这里你可以像:

 Control nextControl; 
 if (e.KeyCode == Keys.Enter)
 {
nextControl = GetNextControl(ActiveControl, !e.Shift);
nextControl.Focus();
if(nextControl=Combo)
{
KeyPreview=false;   
}
e.SuppressKeyPress = true;
}