Click here to Skip to main content
15,879,326 members
Articles / Programming Languages / C#
Tip/Trick

Disabling Close Button (X in top right corner of ControlBox)

Rate me:
Please Sign up or sign in to vote.
4.73/5 (15 votes)
4 Apr 2011CPOL 19.7K   13   7
private const int disableX = 0x200;
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams ObjClose = base.CreateParams;
                ObjClose.ClassStyle = ObjClose.ClassStyle | disableX;
                return ObjClose;
            }
        }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
I do not claim to be wrong! I just rarely ever write.

Comments and Discussions

 
GeneralRe: I think that using API functions to do this job is better th... Pin
Youzelin5-Jul-11 21:36
Youzelin5-Jul-11 21:36 
GeneralReason for my vote of 3 I think using API to do this job is ... Pin
Youzelin4-Jul-11 20:56
Youzelin4-Jul-11 20:56 
GeneralRe: Well if you think so where is the Alternative???? Pin
charles henington5-Jul-11 14:08
charles henington5-Jul-11 14:08 
GeneralReason for my vote of 5 small good tip Pin
boh-unipac13-Apr-11 6:44
boh-unipac13-Apr-11 6:44 
GeneralRe: Thanks hope it helps Pin
charles henington18-Apr-11 5:08
charles henington18-Apr-11 5:08 
GeneralReason for my vote of 5 nice share Pin
Ridho Anggoro4-Apr-11 23:11
Ridho Anggoro4-Apr-11 23:11 
Reason for my vote of 5
nice share
GeneralRe: thanks Pin
charles henington6-Apr-11 4:42
charles henington6-Apr-11 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.