Mousewheel scroll event for combobox

Add-in Express™ Support Service
That's what is more important than anything else

Mousewheel scroll event for combobox
 
IT Support




Posts: 12
Joined: 2016-08-19
Hello,

I have created a taskpane in Outlook which include a couple of comboboxes. When I bring my mouse to the region of the combobbox (without clicking on it) and scroll using the mousewheel, my selected item keep changing in the combobox when I don't want it to. I can't find the Mouse_wheel event in my combobox properties either.(Mouse_up, Mouse_Down,Mouse_Hover etc. are present though)How can I fix this?

Thank you
Posted 21 Jun, 2017 03:19:19 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Hello,

This is normal. You see the same behavior if you place System.Windows.Forms.ComboBox on a System.Windows.Forms.Form.

To bypass this, use this approach:

public class MyComboBox : ComboBox
    {
        protected override void OnMouseWheel(MouseEventArgs e)
        {
            base.OnMouseWheel(e);
            var args = e as HandledMouseEventArgs;
            args.Handled = true;
        }
    }


Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Jun, 2017 04:05:28 Top