5

All, I understand that for extensively customised dialogs I would need to create my own form and ShowDialog(). However, in my current case I would just like to extend the MessageBox class to facilitate a CustomMessageBox that is capable of showing different icons insted of those determined by the system.

I have not overridden such a control before and I am not even sure where to start. Could someone point me in the right direction?

Thanks for your time.

MoonKnight
  • 23,214
  • 40
  • 145
  • 277
  • possible duplicate of [MessageBox.Show() Custom Icon?](http://stackoverflow.com/questions/6560493/messagebox-show-custom-icon) – Matthew Watson Mar 15 '13 at 13:17

3 Answers3

6

MessageBox is not a control actually (doesn't inherit from Control), it's just a class.

Actually, it's even almost a static class, as there is no public/protected constructor defined, and only static methods. It's more like a factory.

You probably should write your own, as it's not extendable.

ken2k
  • 48,145
  • 10
  • 116
  • 176
2

You can't customize MessageBox like that, unfortunately. You will have to roll-your-own.

Matthew Watson
  • 104,400
  • 10
  • 158
  • 276
2

MessageBox does not support customization beyond changing the message, caption, and the standard buttons that are available. If you want a custom message box, you have to create one yourself. See How to create a custom MessageBox? for an example.

Community
  • 1
  • 1
Jim Mischel
  • 131,090
  • 20
  • 188
  • 351