The standard
MessageBox
class of
.NET
shows the MessageBox by the
Show
static method. The Show static method
generates the MessageBox
internally using the various arguments passed to it and returns
DialogResult
enum member.
The actual instance of the
MessageBox
is not available to the user to manipulate the content and features of MessageBox like disabling the close button.
Hence, the author of the Article referred in the question has created a custom
extended message box
with several features. One of the feature is to disable the close button.
The
extended MessageBox
created by the author is derived from the
Windows.Forms.Form
as can be seen from the class declaration given in the source code downloaded from the above article show below
internal class MessageBoxExForm : System.Windows.Forms.Form
Since, the
extended MessageBox
is derived from the
Form
class it can be passed to the
private void DisableCloseButton(Form form)
as an argument. This method is not meant to pass the standard
MessageBox
to it.