Size of MessageBox Size of MessageBox wpf wpf

Size of MessageBox


You aren't going to find anything like that documented, however according to Raymond in Windows Vista the message box algorithm determined the width of the message box by choosing the smallest of the following which resulted in a box that fits in the working area:

  • The width of the longest line
  • 278 DLU (Dialog units)
  • 5/8 of the width of the working area
  • 3/4 of the width of the working area
  • 7/8 of the width of the working area

(I interpred this to mean that (for example) the width will be 5/8th of the width of the working area unless this results in the dialog which is taller than the height of the working area, in which case it will use a wider width).

This should at least give you some pointers for choosing a maximum width that doesn't look out of place.

As far as I am aware the message box doesn't have a maximum height, but I imagine a similar algorithm would work nicely.

If your dialog genuinely is very large then you might want to consider just making the dialog resizable / maximizable. (I'm not a fan of dialogs that display lists that are too large but don't allow you to resize the dialog to a more suitable size).