What you are describing is similar to what you want to reproduce functionality, such as Microsoft Outlook, where you do not need to click to focus the control in order to use the mouse wheel on it.
This is a rather difficult task to solve: it includes the implementation of the IMessageFilter interface of the contained form, the search for WM_MOUSEWHEEL events WM_MOUSEWHEEL and their direction to the control that the mouse is over.
Here's an example (from here ):
using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; namespace WindowsApplication1 { public partial class Form1 : Form, IMessageFilter { public Form1() { InitializeComponent(); Application.AddMessageFilter(this); } public bool PreFilterMessage(ref Message m) { if (m.Msg == 0x20a) {
Please note that this code is active for all forms in your application, and not just for the main form.
Jon grant
source share