OnMouseWheel Event Not Working w/Runtime-Generated Controls
Summary:
Creating controls at runtime and laying them out on a form; using AddHandler to assign subs to control events. MouseMove and MouseUp work fine, but MouseWheel does not work. Desktop (not Web) app, VS2005, no add-ins, plug-ins, etc. Vanilla install of VB2005 EE. No error messages or warnings at design- or runtime.
Background:
I'm working on an app that dynamically defines and lays out controls at runtime based on the dimensions of the form (_resize event will also affect these controls). The code that manages the definition & layout also assigns event handlers to these controls using AddHandler. Nearly everything works just fine as I need it.
The only controls that are dynamically generated in this fashion are PictureBoxes. The handlers I assign cover the MouseMove, MouseUp, and MouseWheel events for each such created PB.
The Problem:
OnMouseWheel event code does not appear to be fired off correctly. There is no error or warning for the AddHandler line that associates the generic handler sub with the dynamically-generated control event, nor is there an unhandled runtime error when the mouse wheel is scrolled over the controls at runtime.
The code for the MouseMove and MouseUp events fires normally as expected.
Relevant Snippets:
In the runtime control declaration:
...
[...formatting, layout code for pic...]
AddHandler pic.MouseUp, AddressOf handleMouseUpPictureBox
...
The MouseWheel handler code:
Friend Sub handleMouseWheelPictureBox(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
End Sub
Any help that you could provide would be enormously useful. Thanks in advance for your time!

