C# formatting a MessageBox

Any reason not to just create a Form with a textbox/label using a monospace font, then call Form.ShowDialog? Sounds like a separate library with that would be overkill to me.


For the record, this is in fact possible, MessageBox() expands tabs. For example:

    private void button1_Click(object sender, EventArgs e) {
        MessageBox.Show(
            "hello\tworld\r\n" + 
            "second\tline");
    }

It isn't very trustworthy if the word width starts to approach the tab width. You still should prefer a little helper form with a ListView.


I have just written a single file replacement for MessageBox with a changeable font. You can download it here and use it like a standard MessageBox:

http://www.codeproject.com/Articles/601900/FlexibleMessageBox-A-flexible-replacement-for-the

Regards, Jörg