How to find out if the left shift or right shift key has been pressed down …

Add this declaration.

[DllImport("user32")]
public static extern short GetKeyState (Keys VirtKey);

On your KeyDown event, you can check which shift key has been pressed down in this way:

bool LShiftPressed = ((GetKeyState(Keys.LShiftKey) & 256)==256);
bool RShiftPressed = ((GetKeyState(Keys.RShiftKey) & 256)==256);


 
 
 

Leave a Reply