Nov 6, 2011 at 11:43 PM
Edited Nov 6, 2011 at 11:48 PM
That worked perfectly, thank you! I feel a bit newbish (which I am) because I hadn't noticed that the type for e.KeyCode was System.Windows.Forms.Keys.
I have one more question, perhaps I should start it in another thread (if so please let me know) - is it currently possible to suppress the scroll wheel? I noticed that adding the code below seemed to catch the mouse scroll sometimes. It seemed
flaky though, if I did a check on ((e.Delta != 0) && isCtrlDn) it never seemed to make it inside my IF statement, but if I put a breakpoint on the IF itself and then stepped through it, it would go inside the IF statement just fine. Setting it
up using mouse.MouseWheel works exactly as intended with the same code except that I can't suppress the scroll (e does not have the property for Handled). Any thoughts?
The event I tried hooking into:
mouse.MouseMoveExt += new EventHandler<MouseEventExtArgs>(ProcessMouseWheel);
This one works:
mouse.MouseWheel += new MouseEventHandler(ProcessMouseScroll);
private void ProcessMouseScroll(object sender, MouseEventArgs e)
if ((isLAltDn || isRAltDn) && e.Delta != 0)
//do something, works for the MouseWheel event
//however if the event is MouseMoveExt setting a breakpoint in here will never go off
(note: I did have to change the type of e in ProcessMouseScroll from MouseEventArgs to MouseEventExtArgs to use it with MouseMoveExt, just mentioning this for completeness)