public bool PreFilterMessage(ref Message m)
{
if (m.Msg == (int)WindowsMessages.WM_MOUSEMOVE)
{
if (this.MouseMove != null) this.MouseMove(this, EventArgs.Empty);
}
else if (m.Msg == (int)WindowsMessages.WM_MOUSELEAVE)
{
if (this.MouseLeave != null) this.MouseLeave(this, EventArgs.Empty);
}
else if (m.Msg == (int)WindowsMessages.WM_LBUTTONUP)
{
if (this.MouseUp != null) this.MouseUp(this, EventArgs.Empty);
}
else if (m.Msg == (int)WindowsMessages.WM_RBUTTONUP)
{
if (this.MouseUp != null) this.MouseUp(this, EventArgs.Empty);
}
else if (m.Msg == (int)WindowsMessages.WM_MOUSEWHEEL)
{
if (this.MouseWheel != null) this.MouseWheel(this, EventArgs.Empty);
}
else if (m.Msg == (int)WindowsMessages.WM_KEYDOWN)
{
if (this.KeyDown != null)
{
KeyEventArgs args = new KeyEventArgs((Keys)m.WParam.ToInt32());
this.KeyDown(this, args);
return args.Handled;
}
}
return false;
}