Rectangle clientRect = new Rectangle();
if (GetClientRect(new HandleRef(this, this.Handle), ref clientRect))
{
int x = LOWORD(m.LParam);
int y = HIWORD(m.LParam);
if (!clientRect.Contains(x, y)) return false;
}
IsIgnoreMessage は、こうなりました。
private bool IsIgnoreMessage(Message m)
{
if (m.Msg >= WM_KEYFIRST && m.Msg <= WM_KEYLAST)
{
if (m.Msg == WM_KEYDOWN && (Keys)m.WParam == Keys.F4) return false;
return true;
}
if (m.Msg >= WM_MOUSEFIRST && m.Msg <= WM_MOUSELAST)
{
Rectangle clientRect = new Rectangle();
if (GetClientRect(new HandleRef(this, this.Handle), ref clientRect))
{
int x = LOWORD(m.LParam);
int y = HIWORD(m.LParam);
if (!clientRect.Contains(x, y)) return false;
}
return true;
}
return false;
}