Normally clicking ‘X’ button at the top right corner will exit the application. I want my window form application to exit only when holding the ‘Shift’ click. How can I do that?
Normally clicking ‘X’ button at the top right corner will exit the application. I
Share
You can add a handler to the
Closingevent and cancel if the appropriate modifiers are set by checkingKeyboard.Modifiersand cancel as necessary. You may need to add logic to check if the mouse clicked the close button if you wish.