views:

1587

answers:

1

I'm trying to show a zoomed in overlay on an image when mouse over and shift key pressed.

The problem is that user might have pressed the shift key before even the window has focus, so KeyDown monitoring is not a solution.

Is there a way to access modifier key states during mouse events? In Java for example the mouse event contains flags for modifier keys, not so in .NET.

+9  A: 

Try using the Control.ModifierKeys property:

if ((Control.ModifierKeys & Keys.Shift) != Keys.None)
{
    // do my stuff
}
Vojislav Stojkovic
Works great, thanks!
extropy