From 86895306e0433db57aa59b3b4afecf329a9be10f Mon Sep 17 00:00:00 2001 From: niksedk Date: Sat, 16 Sep 2023 09:37:47 +0200 Subject: [PATCH] Let scroll wheel work when mouse-over on combobox + numeric up/down Related to #7200 --- src/ui/Controls/NikseComboBox.cs | 2 +- src/ui/Controls/NikseTimeUpDown.cs | 18 ++++++++++++++++++ src/ui/Controls/NikseUpDown.cs | 18 ++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/ui/Controls/NikseComboBox.cs b/src/ui/Controls/NikseComboBox.cs index b6bff89cb..f85ffa45e 100644 --- a/src/ui/Controls/NikseComboBox.cs +++ b/src/ui/Controls/NikseComboBox.cs @@ -520,7 +520,7 @@ namespace Nikse.SubtitleEdit.Controls MouseWheel += (sender, e) => { - if (_textBox == null || !(_textBox.Focused || base.Focused)) + if (_textBox == null || _listViewShown) { return; } diff --git a/src/ui/Controls/NikseTimeUpDown.cs b/src/ui/Controls/NikseTimeUpDown.cs index 7e77457f9..9dcf0550f 100644 --- a/src/ui/Controls/NikseTimeUpDown.cs +++ b/src/ui/Controls/NikseTimeUpDown.cs @@ -7,6 +7,7 @@ using System.Drawing; using System.Drawing.Drawing2D; using System.Globalization; using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Nikse.SubtitleEdit.Controls { @@ -316,6 +317,23 @@ namespace Nikse.SubtitleEdit.Controls AddValue(0); }; + MouseWheel += (sender, e) => + { + if (_maskedTextBox == null) + { + return; + } + + if (e.Delta > 0) + { + AddValue(-Increment); + } + else if (e.Delta < 0) + { + AddValue(Increment); + } + }; + TabStop = false; _loading = false; diff --git a/src/ui/Controls/NikseUpDown.cs b/src/ui/Controls/NikseUpDown.cs index 8cf9e0fa8..27e3e9ad8 100644 --- a/src/ui/Controls/NikseUpDown.cs +++ b/src/ui/Controls/NikseUpDown.cs @@ -309,6 +309,24 @@ namespace Nikse.SubtitleEdit.Controls }; LostFocus += (sender, args) => _repeatTimer.Stop(); + + MouseWheel += (sender, e) => + { + if (_textBox == null) + { + return; + } + + if (e.Delta > 0) + { + AddValue(-Increment); + } + else if (e.Delta < 0) + { + AddValue(Increment); + } + }; + TabStop = false; }