views:

67

answers:

4

Is there a way I can change the font types in a MessageBox.Show() to get bigger size, bold, italic styles?

+3  A: 

I believe that those fonts are controlled by the operating system.

You could (however) make a custom dialog and put anything you want in there including custom fonts.
Here is the MSDN resource for custom dialogs.
http://msdn.microsoft.com/en-us/library/2chz8edb(VS.90).aspx

TJB
A: 

Have you thought of something like a customized message box (www.html-messagebox.com)?

For more customization such as building an irregular shaped message box (Homer Simpson's head), you are better off creating your own MessageBox-like implementation for your project.

Matrix0
+3  A: 

You can always make your own MessageBox creating a new Windows.Forms class:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MessageBoxFont
{
    public partial class Message : Form
    {
        public Message(String text)
        {
            InitializeComponent();
            tbxMessage.Text = text;
            btnOK.Focus();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

Then you can control the properties (like the font, size, color and the like) shown under the solution explorer. You initialize this form like this:

        private void OpenMessageBox()
        {
            String text = "This is a sample error message";
            Message message = new Message(text);
            message.Show();
        }

Its a work-around, however, easier to implement :)

BennySkogberg
That's what I like about programming. There is always a work-around :)
Braveyard
True! As long as you solve the problem at hand, the way to do it are almost endless :)
BennySkogberg