Crypto-Notepad/Crypto Notepad/ExRichTextBox.cs

32 lines
1 KiB
C#
Raw Normal View History

2019-08-27 07:04:44 +00:00
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Crypto_Notepad
{
public class ExRichTextBox : RichTextBox
{
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
2019-08-27 08:35:02 +00:00
private const int WM_VSCROLL = 0x115;
private const int WM_MOUSEWHEEL = 0x20A;
2019-08-27 07:04:44 +00:00
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_MOUSEWHEEL)
{
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
SendMessage(Handle, WM_VSCROLL, (IntPtr)1, IntPtr.Zero);
}
return;
}
base.WndProc(ref m);
}
2019-08-27 08:35:02 +00:00
2019-08-27 07:04:44 +00:00
}
}