C# 如何在“输入为”选项卡时打开新表单?
当我按下C# 如何在“输入为”选项卡时打开新表单?,c#,winforms,keypress,keydown,C#,Winforms,Keypress,Keydown,当我按下Enter按钮时,它充当Tab,此代码位于form1\u keydown事件中 Control nextControl; if (e.KeyCode == Keys.Enter) { nextControl = GetNextControl(ActiveControl, !e.Shift); nextControl.Focus(); e.SuppressKeyPress = true; } 表单中有组合框,我们按进入按钮,然后打开新表单 如何操作,因为它不适用于cmb\
Enter
按钮时,它充当Tab
,此代码位于form1\u keydown
事件中
Control nextControl;
if (e.KeyCode == Keys.Enter)
{
nextControl = GetNextControl(ActiveControl, !e.Shift);
nextControl.Focus();
e.SuppressKeyPress = true;
}
表单中有组合框
,我们按进入
按钮,然后打开新表单
如何操作,因为它不适用于
cmb\u按键
事件此处您可以编写为:
Control nextControl;
if (e.KeyCode == Keys.Enter)
{
nextControl = GetNextControl(ActiveControl, !e.Shift);
nextControl.Focus();
if(nextControl=Combo)
{
KeyPreview=false;
}
e.SuppressKeyPress = true;
}