I have quite a problem with the mouse wheel event. I've tried to find any sort of references to it but always found answers to different topics on the matter.
I have made a mouse-wheel event for the entire form (which is also fullscreen, but it should work regardless on where the mouse is): MouseWheel+=ChangeLength;
(or MouseWheel += new MouseEventHandler(ChangeLength);
, it doesn't matter) and put a breakpoint on the first line of it, just to see if it works.
It didn't.
I opened a blank project to test it out and surprisingly, it did! I then looked for the source of the problem and found out that only two lines in the designer make the difference between successfully firing the event, and not firing at all. The two lines were
this.rater.TabIndex = 15;
this.rater.Visible = false;
If any of these lines were uncommented, nothing happened when scrolling the mouse wheel, but if both were deleted or commented, it worked just fine. Using Focus()
, clicking on the screen, changing the properties outside the designer and other known methods didn't help.
I need to add that rater
is not just a regular control, and this is probably the source for this weird problem. It is a custom control called ShapeRater. I really don't understand why and how the Visible
and TabIndex
properties cause it, they're completely unrelated! Also, I deleted one of the raters (which caused the problem), because the other one was fine, but once deleted, the previously OK one started causing this instead.
Does anybody have any idea why this is happening and how to fix it?
If I recall correctly, the issue was related to losing focus after using the arrows while in the application, so I ended up replacing the keys for that.