diff --git a/SunnyUI.Demo/Controls/FListBox.cs b/SunnyUI.Demo/Controls/FListBox.cs index b84ea93b..173c71ab 100644 --- a/SunnyUI.Demo/Controls/FListBox.cs +++ b/SunnyUI.Demo/Controls/FListBox.cs @@ -13,7 +13,7 @@ namespace Sunny.UI.Demo public override void Init() { uiListBox1.Items.Clear(); - for (int i = 0; i < 20; i++) + for (int i = 0; i < 50; i++) { uiListBox1.Items.Add(i); } diff --git a/SunnyUI/Controls/UIListBox.cs b/SunnyUI/Controls/UIListBox.cs index 63b57ced..9fb89305 100644 --- a/SunnyUI/Controls/UIListBox.cs +++ b/SunnyUI/Controls/UIListBox.cs @@ -395,13 +395,16 @@ namespace Sunny.UI if (Bar != null && Bar.Visible) { var si = ScrollBarInfo.GetInfo(Handle); + int temp = Math.Abs(e.Delta / 120); if (e.Delta > 10) { - ScrollBarInfo.SetScrollValue(Handle, (si.nPos - SystemInformation.MouseWheelScrollLines) >= si.nMin ? si.nPos - SystemInformation.MouseWheelScrollLines : 0); + int nposnum = si.nPos - temp * SystemInformation.MouseWheelScrollLines; + ScrollBarInfo.SetScrollValue(Handle, nposnum >= si.nMin ? nposnum : 0); } else if (e.Delta < -10) { - ScrollBarInfo.SetScrollValue(Handle, (si.nPos + SystemInformation.MouseWheelScrollLines) <= si.nMax ? (si.nPos + SystemInformation.MouseWheelScrollLines) : si.nMax); + int nposnum = si.nPos + temp * SystemInformation.MouseWheelScrollLines; + ScrollBarInfo.SetScrollValue(Handle, nposnum <= si.nMax ? nposnum : si.nMax); } }