有趣的MessageBox之X button的Enable和disable

大家对这个MessageBox 肯定都不陌生,但有谁注意到对话框右上角的x button,什么情况下是enable,什么情况下是disable的?

一下为msdn的官方解释:

1. http://msdn.microsoft.com/en-us/library/system.windows.messagebox.aspx

To enable a user to close a message box, Show displays a message box that has an OK button and a Close button in the title bar.

2. http://stackoverflow.com/questions/1546082/yesno-messagebox-not-closing-when-x-button-clicked

The Close button (in MsgBox's title bar): Since the MsgBox window is a built-in feature of the operating system, its X button is enabled only when certain buttons are present. If there is only an OK button, clicking the X button is the same as pressing OK. Otherwise, the X button is disabled unless there is a Cancel button, in which case clicking the X is the same as pressing Cancel.

3.自定义MessageBox:

http://www.codeproject.com/Articles/9656/Dissecting-the-MessageBox
原文地址:https://www.cnblogs.com/Jessy/p/2586129.html