都没人回答,自己纠结了1天终于弄好了,
[DllImport("user32.dll")]
public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("user32.dll")]
public static extern bool DeleteMenu(IntPtr hMenu, uint uPosition, uint uFlags);
IntPtr hMenu = GetSystemMenu(Process.GetCurrentProcess().MainWindowHandle, false);
if (hMenu != IntPtr.Zero)
{
DeleteMenu(hMenu, SC_MOVE, MF_BYCOMMAND); //删除移动菜单
DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND);//删除最大化菜单
DeleteMenu(hMenu, SC_SIZE, MF_BYCOMMAND);//删除大小菜单
}