const Int32 MF_BYPOSITION = 1024;//&H400
public enum SystemMenuItemType
{
Restore,
Move,
Size,
Min,
Max,
Seperator,
Close
}
public static void RemoveSystemMenuItem(Form form, SystemMenuItemType menuItem)
{
RemoveMenu(GetSystemMenu(form.Handle.ToInt32(), 0),(int)menuItem, MF_BYPOSITION);
}
public static void RemoveRestoreSystemMenuItem(Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Restore);
}
public static void RemoveMoveSystemMenuItem(Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Move);
}
public static void RemoveSizeSystemMenuItem(Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Size);
}
public static void RemoveMinSystemMenuItem(Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Min);
}
public static void RemoveMaxSystemMenuItem(Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Max);
}
public static void RemoveSeperatorSystemMenuItem(Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Seperator);
}
public static void RemoveCloseSystemMenuItem(Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Close);
}
}</pre></div>
const Int32 MF_BYPOSITION = 1024;//&H400
public enum SystemMenuItemType
{
Restore,
Move,
Size,
Min,
Max,
Seperator,
Close
}
public static void RemoveSystemMenuItem(this Form form, SystemMenuItemType menuItem)
{
RemoveMenu(GetSystemMenu(form.Handle.ToInt32(), 0), (int)menuItem, MF_BYPOSITION);
}
public static void RemoveRestoreSystemMenuItem(this Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Restore);
}
public static void RemoveMoveSystemMenuItem(this Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Move);
}
public static void RemoveSizeSystemMenuItem(this Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Size);
}
public static void RemoveMinSystemMenuItem(this Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Min);
}
public static void RemoveMaxSystemMenuItem(this Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Max);
}
public static void RemoveSeperatorSystemMenuItem(this Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Seperator);
}
public static void RemoveCloseSystemMenuItem(this Form form)
{
RemoveSystemMenuItem(form, SystemMenuItemType.Close);
}
}</pre></div>