1. 程式人生 > >C#組合鍵應用(Ctrl+Enter)

C#組合鍵應用(Ctrl+Enter)

 private void textbox_KeyDown(object sender, KeyEventArgs e)
        {        
             // 如果按下組合鍵CTRL+Enter
            if (e.KeyData == (Keys.Control | Keys.Enter))
            {
                ...
            }
         } 
 private void textbox_KeyDown(object sender, KeyEventArgs e)
        {        
             // 如果按下組合鍵CTRL+R
            if (e.Control && e.KeyCode == Keys.R)
                ...
         } 

 private void textbox_KeyDown(object sender, KeyEventArgs e)
        {        
             // 如果按下組合鍵CTRL+A
            if(e.Modifiers == Keys.Control && e.KeyCode == Keys.A)
                ...
         } 

以上3種都可以