Disabling the Close-Button temporarily

后端 未结 7 1177
后悔当初
后悔当初 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:10

    As per other answers you are working against the guidelines and framework but, if you really must, one work around would be to put all your form content into a Usercontrol and then pass that between form instances that either have the close button enabled or disabled on load.

    So as you trigger the disable or enable of the close button you create a new form instance in which the close button is toggled and then pass in the reference to your usercontrol, then dereference the usercontrol in the current form and transfer to the new form.

    You'd likely get a some flicker as you did this. Terrible idea IMHO but it is "an" option.

提交回复
热议问题