Click here to Skip to main content
15,891,951 members
Articles / Programming Languages / C#

How to extend the native MessageBox dialog in .NET

Rate me:
Please Sign up or sign in to vote.
4.75/5 (13 votes)
4 Aug 2007CPOL8 min read 288.1K   1.2K   74  
This article introduces a way to extend the native MessageBox dialog without using Windows Hooks and message processing.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CoderSky.Demonstration.Windows
{
	public partial class MessageBoxDemoForm : Form
	{
		public MessageBoxDemoForm()
		{
			InitializeComponent();

			propertyGrid1.SelectedObject = messageBox1;
		}

		private void show_Click(object sender, EventArgs e)
		{
			DialogResult result = messageBox1.ShowDialog(this);

			dialogResult.Text = result.ToString();
			timedOut.Text = messageBox1.IsTimedOut.ToString();

			propertyGrid1.SelectedObject = messageBox1;

		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions