2009-06-09 3 views

답변

0

Here is an article 키 상태 (및 마우스)를 직접 읽는 것에 대해. ModifierKeys 속성은 이상적인 보이는

[STAThread] 
    static void Main(string[] args) 
    { 
     if (Control.ModifierKeys == Keys.ShiftKey) 
     { 
      // Do something special 
     } 
    } 
2

확인 Control.ModifierKeys ... :

private void Form1_Load(object sender, EventArgs e) 
{ 
    if ((ModifierKeys & Keys.Shift) != 0) 
    { 
     MessageBox.Show("Shift is pressed"); 
    } 
} 
+0

누구나 내 대답을 왜곡했는지 설명해 주시겠습니까? –

+1

해결책을 찾지 못했습니다. @Dan의 비트 테스트 버전도 작동했습니다. –

0

나는이 게시물에 오히려 오래 알고 있지만 나는이 문제에 달려 수정하여 고정 제이미의 코드 :

[STAThread] 
static void Main(string[] args) 
{ 
    if (Control.ModifierKeys.ToString() == "Shift") 
    { 
     // Do something special 
    } 
} 
관련 문제