2012-01-19 3 views
0

내 이벤트 핸들러는 다음과 같습니다 .NET 버전에서,.NET 2.0에서 ListView에서 DELETE를 누른 경우 어떻게 확인합니까?</p> <pre><code>private void List_KeyPress(object sender, KeyPressEventArgs e) </code></pre> 내가 MSDN의 스레드에서 본 <p>, 다음과 같은 솔루션 :

if(e.KeyCode == Keys.Delete) 

단, KeyPressEventArgs는없는 KeyCode 속성 내 경우 삭제를 어떻게 처리해야합니까? 당신이에서 KeyDown를 사용할 필요가 있으므로, MSDN :

private void List_KeyDown(object sender, KeyEventArgs e) 
{ 
    if(e.KeyCode == Keys.Delete) 
    { 
     // your delete code goes here 
    } 
} 

이 모든 .NET 버전에서, 단지 .NET 2.0에 한정되지 않고,이 .KeyCode 참조가없는 KeyPressEventArgs :

답변

2

는 대신 KeyDown 이벤트를 원하는 대신.

관련 문제