.net difference between right shift and left shift keys

后端 未结 4 1253
陌清茗
陌清茗 2020-12-19 06:46

I am currently working on an application which requires different behaviour based on whether the user presses the right or left shift key (RShiftKey, LShiftKey), however whe

4条回答
  •  天涯浪人
    2020-12-19 07:08

    Thanks guys, good solution there. In the mean time here's my own "hacky" way of doing it from the override of ProcessCmdKey:

    public override bool ProcessCmdKey(ref Message msg, Keys keyData)
    {
        if (msg.LParam.ToInt32() == 0x2a0001)
            LastShiftKey = ShiftKeys.NumericShift;
            else if (msg.LParam.ToInt32() == 0x360001)
                LastShiftKey = ShiftKeys.AlphaShift;
        etc....
    }
    

提交回复
热议问题