void tv_zs_DragDrop(object sender, DragEventArgs e)我在DragDrop事件 想判断有没按了下Ctrl键,怎么搞?

解决方案 »

  1.   

    试一试
    if ((ModifierKeys & Keys.Shift) == Keys.Shift) 
    {
         MessageBox.Show("Pressed " + Keys.Shift);
    }将Shift替换成Ctrl
      

  2.   

    不用钩子的话
    在父容器写 key的事件捕获 ctrl 
      

  3.   

    if(e.KeySate==8) 就是Value Key
    1 (bit 0) The left mouse button.
    2 (bit 1) The right mouse button.
    4 (bit 2) The SHIFT key.
    8 (bit 3) The CTRL key.
    16 (bit 4) The middle mouse button.
    32 (bit 5) The ALT key.
      

  4.   


    MSDN中的解释
    Control.ModifierKeys Property Gets a value indicating which of the modifier keys (SHIFT, CTRL, and ALT) is in a pressed state.例程:private void button1_Click(object sender, System.EventArgs e)
    {
       /* If the CTRL key is pressed when the 
          * control is clicked, hide the control. */
       if(Control.ModifierKeys == Keys.Control)
       {
          ((Control)sender).Hide();
       }
    }
    所有从Control继承的类都可以使用这个属性,例如Form