怎样禁用form右上角的关闭按钮?
1
using System.Runtime.InteropServices;
2
3
[DllImport("User32.dll")]
4
public static extern int GetSystemMenu(int hWnd, int bRevert);
5
6
[DllImport("User32.dll")]
7
public static extern int RemoveMenu(int hMenu, int nPosition, int wFlags);
8
9
private void yourform_Load(object sender, System.EventArgs e)
10
{
11
int lSysMenu;
12
const int MF_BYPOSITION = 1024;
13
lSysMenu = GetSystemMenu(this.Handle.ToInt32(), 0);
14
RemoveMenu(lSysMenu, 6, MF_BYPOSITION);
15
}
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
作者blog: http://www.cnblogs.com/wangsaokui
浙公网安备 33010602011771号