// <file> // <copyright see="prj:///doc/copyright.txt"/> // <license see="prj:///doc/license.txt"/> // <author name="Daniel Grunwald"/> // <version>$Revision: 3064 $</version> // </file> using System; using System.Windows.Forms; namespace ICSharpCode.TextEditor.Util { /// <summary> /// Accumulates mouse wheel deltas and reports the actual number of lines to scroll. /// </summary> class MouseWheelHandler { // CODE DUPLICATION: See ICSharpCode.SharpDevelop.Widgets.MouseWheelHandler const int WHEEL_DELTA = 120; int mouseWheelDelta; public int GetScrollAmount(MouseEventArgs e) { // accumulate the delta to support high-resolution mice mouseWheelDelta += e.Delta; int linesPerClick = Math.Max(SystemInformation.MouseWheelScrollLines, 1); int scrollDistance = mouseWheelDelta * linesPerClick / WHEEL_DELTA; mouseWheelDelta %= Math.Max(1, WHEEL_DELTA / linesPerClick); return scrollDistance; } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The MIT License