9 Options, 4 Icons, 1 MessageBox

You know there are things in life that you never notice or worry about. This is one of them.

The MessageBox API in Windows Forms allows you to specify message box icons to display along side your all-important message you're communicating to the user (System Error, Hard Drive Full, Your Cat is Pregnant, that sort of thing). Icons can help add a little punch to an otherwise drab afternoon staring at rows and rows of spreadsheets and overdue time cards.

The 9 options you can select from to kick your otherwise drab battleship gray business application up are: Asterix, Error, Exclamation, Hand, Information, Question, Stop, Warning, and None. None of course presents no icon. The others provide you with an icon that matches the description. Or does it?

Here's the Asterix option:

clip_image002

And here's the Information option:

clip_image002[5]

Hmmm... something isn't right here. Am I seeing double? No, both options use the same icon.

Onto the Exclamation icon:

clip_image002[7]

And the Warning one:

clip_image002[9]

Hey! You're copying and pasting the same image!

No friends, I really did write a program to do all this (contact me for licensing and source code rights) and they really are different.

Finally here's the Error, Hand, and Stop icons (all conveniently wrapped up in one picture):

clip_image002[11]

Yup. All three use the red 'X' icon. You would think, oh I don't know, the Hand would display a Hand icon and Stop might, oh what the heck I'll take a stab at this, display a Stop sign. Now I'm all for saving on resources. After all, icons cost money to make; take up valuable bytes in the CLR; and lord knows how many hours of debate over the right shade of yellow for the Warning icon was spent. However if you're going to provide a programmer 9 different options (which all seem reasonable and unique) then why would you only provide 4 icons (I neglected to show the Question icon which is indeed a question mark). Did the MessageBox team have their budget cut or something?

In any case, this seemingly random blog entry has been brought to you by the letters M, M, and M and the number M.

7 Comments

  • I'm surprised that there's an "Asterix" option yet no "Obelix" option!

    Or is it really "Asterisk"?

    ;-)

  • Betcha you can assign different _sounds_ to those different icons :)

  • Legacy, legacy...earlier versions of Windows used more icons than those we see in Vista. For reasons of backward compatability the WinForms API still includes these old options.

  • Yeah, I noticed the same thing but my brain never bothered to think about it. It doesn't like thinking.

  • That's actually pretty hilarious.

    This goes up there with the "Catastrophic Error" message that visual studio 2005 can give you, in terms of making me laugh.

    Thank you,
    Richard

  • The names may be there for "backwards compatibility", but the values aren't:

    public enum MessageBoxIcon
    {
    Asterisk = 0x40,
    Error = 0x10,
    Exclamation = 0x30,
    Hand = 0x10,
    Information = 0x40,
    None = 0,
    Question = 0x20,
    Stop = 0x10,
    Warning = 0x30
    }

    Asterisk == Information
    Error == Hand == Stop
    Exclamation == Warning

  • Another hidden feature of MessageBox dialog is that you can copy the text by using Ctrl-C, even they are not selectable. Most cases people use snap-shot to get the message in graphics.

    Unfortunately, some applications design their own message box form instead of using MessageBox. As a result, this feature is not supported in most cases.

Comments have been disabled for this content.