是这样的,我现在在WinForm上画了个点
比如我要同时按下下方向键和有方向键,那么这个点就会移动到其对角线的位置
请问如何实现,谢谢:)

解决方案 »

  1.   

    调用Windows的API吧,或者判断KeyDown事件,在KeyDown事件里处理好了
      

  2.   

    [DllImport("user32.dll")]
    public static extern short GetKeyState(int nVirtKey);
    public const int VK_LEFT = 37;
    public const int VK_UP = 38;
    public const int VK_RIGHT = 39;
    public const int VK_DOWN = 40;private void Form1_KeyDown(object sender, KeyEventArgs e)
    {
        switch (e.KeyCode)
        {
            case Keys.Left:
            case Keys.Right:
            case Keys.Down:
            case Keys.Up:
                if (((GetKeyState(VK_RIGHT) & 0x80) == 0x80) &&
                    ((GetKeyState(VK_DOWN) & 0x80) == 0x80))
                    MessageBox.Show("Zswang 路过");
                break;
        }
    }