Connecting Tech Pros Worldwide Forums | Help | Site Map

Preventing mouse wheel scrolling in a combo box

Greg
Guest
 
Posts: n/a
#1: Aug 23 '06
I need to prevent a combo box's contents from being scrolled using the
mouse wheel.

I've tried using an overridden combo box and ignoring the base call
within
protected override void OnMouseWheel(MouseEventArgs e)
However, for some bizarre reason, the scrolling still works. How can
this be? The info isn't being sent to the base class, so how can it
know to scroll?

Slightly confused here - I'd be grateful for any comments!

Greg


razzielx
Guest
 
Posts: n/a
#2: Aug 23 '06

re: Preventing mouse wheel scrolling in a combo box


If you use .net 2.0 you might use the following event handler

private void YourComboBox_MouseWheel(object sender, MouseEventArgs e)
{
((HandledMouseEventArgs)e).Handled = true;

//do your own processing here
}

razz

"Greg" <gregwilliams001@yahoo.co.ukwrote in message
news:1156323289.060159.228210@i3g2000cwc.googlegro ups.com...
Quote:
>I need to prevent a combo box's contents from being scrolled using the
mouse wheel.
>
I've tried using an overridden combo box and ignoring the base call
within
protected override void OnMouseWheel(MouseEventArgs e)
However, for some bizarre reason, the scrolling still works. How can
this be? The info isn't being sent to the base class, so how can it
know to scroll?
>
Slightly confused here - I'd be grateful for any comments!
>
Greg
>

Greg
Guest
 
Posts: n/a
#3: Aug 24 '06

re: Preventing mouse wheel scrolling in a combo box


Fantastic, that worked a treat - thank you Razz!

razzielx wrote:
Quote:
If you use .net 2.0 you might use the following event handler
>
private void YourComboBox_MouseWheel(object sender, MouseEventArgs e)
{
((HandledMouseEventArgs)e).Handled = true;
>
//do your own processing here
}
>
razz
>
"Greg" <gregwilliams001@yahoo.co.ukwrote in message
news:1156323289.060159.228210@i3g2000cwc.googlegro ups.com...
Quote:
I need to prevent a combo box's contents from being scrolled using the
mouse wheel.

I've tried using an overridden combo box and ignoring the base call
within
protected override void OnMouseWheel(MouseEventArgs e)
However, for some bizarre reason, the scrolling still works. How can
this be? The info isn't being sent to the base class, so how can it
know to scroll?

Slightly confused here - I'd be grateful for any comments!

Greg
Closed Thread