[DllImport("user32.dll", EntryPoint = "RemoveMenu")] public static extern int RemoveMenu(IntPtr hMenu, int nPosition, int wFlags); [DllImport("user32.dll", EntryPoint = "GetSystemMenu")] public static extern IntPtr GetSystemMenu(IntPtr hwnd, int bRevert); public const int SC_MOVE = 61456; public const int MF_BYCOMMAND = 0; public const int MF_DISABLED = 2; public const int MF_GRAYED = 1; private void button1_Click(object sender, EventArgs e) { IntPtr hMenu = GetSystemMenu(this.Handle, 0); RemoveMenu(hMenu, SC_MOVE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); }
例子下载