Disabling the Close-Button temporarily

后端 未结 7 1165
后悔当初
后悔当初 2020-12-31 14:45

I need to disable just the close button (minimize and maximize should be allowed) temporarily.

Every solution I\'ve tried disables all the buttons

7条回答
  •  情歌与酒
    2020-12-31 15:08

    Although it may be possible, I have never seen it. That's just not how programs do it and your program should follow known patterns so it's users know how to use it.

    If closing a program is temporarily not possible, show a message explaining why, when your user tries. This way you can present a solution ("you must first do...") instead of simply presenting a problem ("cannot be closed").

    In addition, there are multiple ways to close a form. You are only looking at one of them. Disabling one will still leave the others and you would want to prevent all options that lead to closing your window, so it's best to handle the Closing event appropriately.

提交回复
热议问题