we can also override the CreateParams Code:
[I did not write this code, but i found it a while back.]
Visual C# .NET
-------------------------------------------------
#region "Disable the 'X'"
protected override CreateParams CreateParams {
get {
CreateParams cp = base.CreateParams;
const int CS_NOCLOSE = 0x200;
cp.ClassStyle = cp.ClassStyle | CS_NOCLOSE;
return cp;
}
}
#endregion
Visual Basic .NET
-------------------------------------------------
#Region "Disable the 'X'"
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_NOCLOSE As Integer = &H200
cp.ClassStyle = cp.ClassStyle Or CS_NOCLOSE
Return cp
End Get
End Property
#End Region