只能让它不起作用. private void yourform_Load(object sender, System.EventArgs e) { int lSysMenu; const int MF_BYPOSITION = 1024; lSysMenu = WinApi.GetSystemMenu(this.Handle.ToInt32(), 0); WinApi.RemoveMenu(lSysMenu, 6, MF_BYPOSITION); //WinApi.RemoveMenu(lSysMenu, 5, MF_BYPOSITION); } ===================== public class WinApi { [DllImport("User32.dll")] public static extern int GetSystemMenu(int hWnd, int bRevert); [DllImport("User32.dll")] public static extern int RemoveMenu(int hMenu, int nPosition, int wFlags); }
{
int lSysMenu;
const int MF_BYPOSITION = 1024;
lSysMenu = WinApi.GetSystemMenu(this.Handle.ToInt32(), 0);
WinApi.RemoveMenu(lSysMenu, 6, MF_BYPOSITION);
//WinApi.RemoveMenu(lSysMenu, 5, MF_BYPOSITION);
}
=====================
public class WinApi
{
[DllImport("User32.dll")]
public static extern int GetSystemMenu(int hWnd, int bRevert);
[DllImport("User32.dll")]
public static extern int RemoveMenu(int hMenu, int nPosition, int wFlags);
}
重画
http://www.microsoft.com/China/Community/TechZone/TechArticle/TechDoc/csharpui.asp