protected virtual IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
switch (msg)
{
case 0X46: //WM_WINDOWPOSCHANGING
//WINDOWPOS windowPos = (WINDOWPOS)msg.GetLParam(typeof(WINDOWPOS));
//if (windowPos.x + windowPos.cx > screenRect.Right)
//{
// windowPos.x = screenRect.Right - windowPos.cx;
//}
//if (windowPos.y + windowPos.cy > screenRect.Bottom)
//{
// windowPos.y = screenRect.Bottom - windowPos.cy;
//}
//if (windowPos.x < screenRect.Top)
//{
// windowPos.x = screenRect.Top;
//}
//if (windowPos.y < screenRect.Left)
//{
// windowPos.y = 0;
//}
//Marshal.StructureToPtr(windowPos, lParam, false);
//base.WndProc(ref m);
break;
default:
//base.WndProc(ref m);
break;
}
return IntPtr.Zero;
}