From 9c8aa24d3b11a195d9da050bece9daa91ddbd886 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Mon, 13 Nov 2006 21:47:35 +0000 Subject: [PATCH] * TextBoxBase.cs: Compute the value changes for the mouse wheel teh simple way. svn path=/trunk/mcs/; revision=67798 --- .../System.Windows.Forms/ChangeLog | 5 +++++ .../System.Windows.Forms/TextBoxBase.cs | 22 ++++------------------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog index 52fcc6d2b92..3b6585a2380 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,3 +1,8 @@ +2006-11-13 Jackson Harper + + * TextBoxBase.cs: Compute the value changes for the mouse wheel + teh simple way. + 2006-11-13 Chris Toshok * XplatUIX11.cs, XplatUIStructs.cs: kind of a gross fix for diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs index 41c2d7f0c66..58a756d1179 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs @@ -1555,24 +1555,10 @@ namespace System.Windows.Forms { return; } - if (e.Delta < 0) { - line_no = document.GetLineByPixel(document.ViewPortY, false).line_no + SystemInformation.MouseWheelScrollLines; - if (line_no > document.Lines) { - line_no = document.Lines; - } - } else { - line_no = document.GetLineByPixel(document.ViewPortY, false).line_no - SystemInformation.MouseWheelScrollLines; - if (line_no < 1) { - line_no = 1; - } - } - - line = document.GetLine(line_no); - if (line.Y < vscroll.Maximum) { - vscroll.Value = line.Y; - } else { - vscroll.Value = vscroll.Maximum; - } + if (e.Delta < 0) + vscroll.Value = Math.Min (vscroll.Value + SystemInformation.MouseWheelScrollLines, vscroll.Maximum - document.ViewPortHeight + 1); + else + vscroll.Value = Math.Max (0, vscroll.Value - SystemInformation.MouseWheelScrollLines); } internal virtual void SelectWord () -- 2.11.4.GIT