Is it possible to create a message box that displays html content?

I want aperture windows to display well, with the ability to use bold / italic text and text with different colors. The standard MessageBox.Show does not provide this functionality.

I am trying to create a message box using a WebBrowser control to display well-formatted text using HTML syntax. But I failed.

Do you know if this is possible, or do you know any other way to show a message box with formatted text? I want the message box to dynamically display its content.

(for Windows Forms)


source to share

3 answers

You can create your own Form class that hosts a WebBrowser control (or RTF control) to display formatted content. Just give it an interface (API) similar to MessageBox so you can use it the same way (for example checking the user's Yes / No or Ok / Cancel / etc responses).

For sizing, you will most likely need to check the displayed content and use some of the System.Drawing features to get the font / content size for it. Then change your window accordingly and / or show and hide the scrollbars so that they only show when needed.



I just created and posted a product, HTML MessageBox, that solves exactly the Mikael problem. It is a replacement for the standard Windows API MessageBox call, allowing bold, underline, italic, and fonts to be used. And it behaves like a standard MessageBox, auto-detecting message size, word wrapping, etc. Also, it is a small manual control code that does not use a heavy IE window to render HTML.

The product includes interfaces for invoking the standard Windows API calling convention, either through COM or from a .NET class. (Also PowerBuilder, because I originally created this to work in my own PowerBuilder app!)

It's at



The HTML MessageBox I mentioned in an earlier answer is now free and available at (The old url disappeared a while ago - sorry!)



All Articles