0

I want to disable Only the close button of my windows form

this.ControlBox = false;

disables all the function even the minimize and maximize button

is there other way to solve this. It is OK if it is visible but cannot be clicked.

office puppy
  • 67
  • 2
  • 8
  • 2
    Please refer to this link: [Windows Forms: How to hide Close (x) button?](http://stackoverflow.com/questions/7301825/windows-forms-how-to-hide-close-x-button) – Maciej S. Apr 21 '16 at 07:10

1 Answers1

1

You cannot disable only the "X" button from controlbox. You can change the FormBorderStyle and build your own custom buttons.

If you want it to be visible but change the close behavior, you can listen Form_Closing event and check the CloseReason property of FormClosingEventArgs object.

ali
  • 1,301
  • 10
  • 12