C# – How to hide only the Close (x) button

cwinforms

I have a modal dialog, and need to hide the Close (X) button, but I cannot use
ControlBox = false, because I need to keep the Minimize and Maximize buttons.

I need to hide just Close button, is there any way to do that?

Thanks a lot!

Update: I had permission to disable it, which is simpler 🙂 Thanks all!

Best Answer

We can hide close button on form by setting this.ControlBox=false;

Note that this hides all of those sizing buttons. Not just the X. In some cases that may be fine.