mirror of
https://github.com/colhountech/DarkUI.Net5.git
synced 2025-07-01 14:49:28 +03:00
28 lines
814 B
C#
28 lines
814 B
C#
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace DarkUI
|
|
{
|
|
public class DarkControlScrollFilter : IMessageFilter
|
|
{
|
|
public bool PreFilterMessage(ref Message m)
|
|
{
|
|
switch (m.Msg)
|
|
{
|
|
case (int)WM.MOUSEWHEEL:
|
|
case (int)WM.MOUSEHWHEEL:
|
|
var hControlUnderMouse = Native.WindowFromPoint(new Point((int)m.LParam));
|
|
|
|
if (hControlUnderMouse == m.HWnd)
|
|
return false; // Already headed for the right control.
|
|
|
|
// Redirect the message to the control under the mouse.
|
|
Native.SendMessage(hControlUnderMouse, (uint)m.Msg, m.WParam, m.LParam);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|