Menu

#23 Mouse scroll 1 screen at a time not working

open
nobody
None
5
2009-11-05
2009-11-05
SteveT
No

I have mouse set to scroll 1 screen at a time, but this does not work in the control. It does nothing.

I fixed by changing

protected override void OnMouseWheel(MouseEventArgs e)
{
_search.EndSearch();
if (SystemInformation.MouseWheelScrollLines > 0)
{
int lines = e.Delta / 120 * SystemInformation.MouseWheelScrollLines;
int newValue = _vScrollBar.Value - lines;
newValue = Math.Min(_vScrollBar.Maximum - _vScrollBar.LargeChange + 1, newValue);
newValue = Math.Min(_vScrollBar.Maximum, newValue);
_vScrollBar.Value = Math.Max(_vScrollBar.Minimum, newValue);
}

base.OnMouseWheel(e);
}

to

protected override void OnMouseWheel(MouseEventArgs e)
{
_search.EndSearch();
if (SystemInformation.MouseWheelScrollLines > 0)
{
int lines = e.Delta / 120 * SystemInformation.MouseWheelScrollLines;
int newValue = _vScrollBar.Value - lines;
newValue = Math.Min(_vScrollBar.Maximum - _vScrollBar.LargeChange + 1, newValue);
newValue = Math.Min(_vScrollBar.Maximum, newValue);
_vScrollBar.Value = Math.Max(_vScrollBar.Minimum, newValue);
}
if (SystemInformation.MouseWheelScrollLines == -1) // Scroll a page at a time
{
int lines = e.Delta / 120 * SystemInformation.MouseWheelScrollLines;
int newValue = _vScrollBar.Value + _vScrollBar.LargeChange * lines;
newValue = Math.Min(_vScrollBar.Maximum - _vScrollBar.LargeChange + 1, newValue);
newValue = Math.Min(_vScrollBar.Maximum, newValue);
_vScrollBar.Value = Math.Max(_vScrollBar.Minimum, newValue);
}
base.OnMouseWheel(e);
}

in TreeViewAdv.Input.cs

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.