2015-06-20 79 views
1

當我按下按鈕Enter,它如何在輸入爲選項卡時打開新窗體?

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

有一個形式comboBox這是我們按下按鈕Enter然後打開New Form作爲Tab這個代碼在form1_keydown事件。
如何做到這一點,因爲它不cmb_KeyPress事件工作

回答

1

在這裏你可以WIRTE爲:

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

是非常感謝 – Elixir

相關問題