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; }