日期:2014-05-18 浏览次数:21109 次
using System; using System.Windows.Forms; using System.Runtime.InteropServices; class Test : Form { const int MF_BYPOSITION = 0x0400; const int MF_REMOVE = 0x1000; [DllImport("user32.dll",EntryPoint="GetSystemMenu")] extern static IntPtr GetSystemMenu(IntPtr hWnd, IntPtr bRevert); [DllImport("user32.dll",EntryPoint="RemoveMenu")] extern static int RemoveMenu(IntPtr hMenu, int nPos, int flags); Test() { Text = "不能移动和改变大小的窗口"; FormBorderStyle = FormBorderStyle.FixedSingle; MaximizeBox = false; MinimizeBox = false; RemoveMenu(GetSystemMenu(Handle,IntPtr.Zero),1,MF_BYPOSITION|MF_REMOVE); } static void Main() { Application.Run(new Test()); } }