From 1a7eeb1bc7d9d7776a686f40a17ebbbaae233e40 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 30 Aug 2019 12:21:55 +0300 Subject: [PATCH] Fixed #26 --- Crypto Notepad/ExRichTextBox.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Crypto Notepad/ExRichTextBox.cs b/Crypto Notepad/ExRichTextBox.cs index 53c4a5b..f9c2d2d 100644 --- a/Crypto Notepad/ExRichTextBox.cs +++ b/Crypto Notepad/ExRichTextBox.cs @@ -17,10 +17,17 @@ protected override void WndProc(ref Message m) int scrollLines = SystemInformation.MouseWheelScrollLines; for (int i = 0; i < scrollLines; i++) { - if ((long)m.WParam <= 2147483647) - SendMessage(Handle, WM_VSCROLL, (IntPtr)0, IntPtr.Zero); - else + try + { + if ((int)m.WParam >= 0) + SendMessage(Handle, WM_VSCROLL, (IntPtr)0, IntPtr.Zero); + else + SendMessage(Handle, WM_VSCROLL, (IntPtr)1, IntPtr.Zero); + } + catch (OverflowException) + { SendMessage(Handle, WM_VSCROLL, (IntPtr)1, IntPtr.Zero); + } } return; }