Skip to content

Instantly share code, notes, and snippets.

@khigia
Created October 16, 2009 01:57
Show Gist options
  • Save khigia/211473 to your computer and use it in GitHub Desktop.
Save khigia/211473 to your computer and use it in GitHub Desktop.
C# NumericUpDown MouseWheel event
class MyNumericUpDown : NumericUpDown
{
protected override void OnMouseWheel (MouseEventArgs e)
{
// remove scrolllines scaling, taking care of case scrolllines is 0
int delta = e.Delta / Math.Max (Math.Abs (SystemInformation.MouseWheelScrollLines), 1);
base.OnMouseWheel (new MouseEventArgs (e.Button, e.Clicks, e.X, e.Y, delta));
}
}
@LiamKarlMitchell
Copy link

Fixes increment of NumericUpDown being 3 instead of 1.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment