2008-12-10 80 views
2

我需要保持箭頭鍵不能滾動瀏覽我的各個選項卡。任何人都知道如何做到這一點?從TabControl C#Winform中滾動選項卡停止箭頭鍵

+0

任何不希望發生這種情況的特殊原因? – 2008-12-11 01:07:16

+0

是的,我不想在輸入密碼之前切換標籤頁。 – Matt 2008-12-11 21:58:19

+0

我很震驚,如果一個答案甚至不能工作,答案就會被標記爲解決方案! KeyPress事件不適用於箭頭鍵。 – 2015-02-22 22:21:57

回答

-1

我認爲你可以捕獲事件「按鍵響應」爲控制

然後把手你有

System::Windows::Forms::KeyPressEventArgs^ e 

然後檢查

if (e->KeyChar == [find the number representing the arrow key]) 
    e->Handled = true; // Meaning that no one will receive it afterwards 
0

我固定的問題有以下代碼

string tempstring = e.KeyValue.ToString(); 
if (tempstring == "37" || tempstring == "38" || tempstring == "39" || tempstring == "40") 
{ 
    e.Handled = true; 
} 

我把它放在tabControl1_KeyDown(object sender,KeyEventArgs e)方法中。