How to tell if Shift is being pressed in a MouseDown event?
Use the Control.ModifierKeys property to see what's pressed. For example:
private void Form1_MouseClick(object sender, MouseEventArgs e) {
if (Control.ModifierKeys == Keys.Control) {
Console.WriteLine("Ctrl+Click");
}
}
Other modifiers are Keys.Alt
and Keys.Shift
. Find combinations with, say, (Keys.Control | Keys.Shift)
.
In C#, you can check using -
Keyboard.IsKeyDown(Key.LeftShift) or key.RightShift
http://msdn.microsoft.com/en-us/library/system.windows.input.keyboard.iskeydown.aspx
http://msdn.microsoft.com/en-us/library/system.windows.input.key.aspx