Using the Code
During construction and creation of the Form
object, .NET would use the default creation parameters available in the base class CreateParams
property. In fact, CreateParams
property is available in Forms.Control
class. In our form class (derived from System.Windows.Forms.Form
), override this property and modify the creation flags. For disabling the Close button use 0x200 to modify the ClassStyle
member of the CreateParams
.
private const int CP_NOCLOSE_BUTTON = 0x200;
protected override CreateParams CreateParams
{
get
{
CreateParams myCp = base.CreateParams;
myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;
return myCp;
}
}
No comments:
Post a Comment