在窗体类中添加如下代码即可禁用关闭按钮(关闭按钮变灰):
protected override CreateParams CreateParams
{
get
{
int CS_NOCLOSE = 0x200;
CreateParams parameters = base.CreateParams;
parameters.ClassStyle |= CS_NOCLOSE;
return parameters;
}
}
protected override CreateParams CreateParams
{
get
{
int CS_NOCLOSE = 0x200;
CreateParams parameters = base.CreateParams;
parameters.ClassStyle |= CS_NOCLOSE;
return parameters;
}
}
偶不理解其实现原理,懂的朋友请为我讲解一下,谢谢.