KeyDown : recognizing multiple keys

后端 未结 13 2756
悲&欢浪女
悲&欢浪女 2020-12-03 02:47

How can I determine in KeyDown that CtrlUp was pressed.

private void listView1_KeyDown(object sender, KeyEventArgs e)
{
           


        
13条回答
  •  清歌不尽
    2020-12-03 03:19

    you can try my working code :

    private void listView1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.Up)
        {
            if(e.Alt==true){
                //do your stuff
            }
        }
    }
    

    i use this code because i don't know why when i use :

    (e.Keycode == Keys>up && e.Alt==true)
    

    didn't work.

提交回复
热议问题