private IntPtr WidProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == 0x112) { if (wParam.ToInt32() == 0xF093)//单击打开菜单 handled = true; if (wParam.ToInt32() == 0xF100) //键盘打开菜单 handled = true; } if (msg == 0xa4) { if (wParam.ToInt32() == 0x02) //非图标的非客户区 handled = true; if (wParam.ToInt32() == 0x03)//right key 图标 handled = true; } return IntPtr.Zero; }