2

Add this code any where in your main form and You will be able to disable the X button on a winForm

Edited by abelLazm: n/a

private const int dis_close_button = 0x200;
 protected override CreateParams CreateParams
 {
     get
     {
        CreateParams ObjCP = base.CreateParams;
        ObjCP.ClassStyle = ObjCP.ClassStyle | dis_close_button ;
        return ObjCP;
     }
 }
1
Contributor
0
Replies
2
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.