views:

1664

answers:

3

in C# winforms when we display a message box it has no title in the title bar and no title in its button that is in the task bar.

What if i want to set title and icon for a message box.

one option is that create a form that appears and behaves like a message box and i show and hide it when i want. yes that can be done but i want to modify the "MessageBox"

+7  A: 

Use a MessageBox.Show overload such as:

public static DialogResult Show(
    string text,
    string caption,
    MessageBoxButtons buttons,
    MessageBoxIcon icon
)

passing your title bar text in caption and your icon in icon e.g.

MessageBox.Show("Oh noes!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
itowlson
That's the one, beat me to it
colithium
The problem is that when minimized, the icon is not showed on the taskbar, I think this is what he wants...
Svetlozar Angelov
Hmm, if he wants a message box that appears on the taskbar, has a window icon and can be minimised (or allows the underlying window to be minimised) then he will need to write a custom form. You can't do all that with MessageBox -- it's pretty primitive!
itowlson
+1  A: 

There is an overloaded version of show message box that will accept a title string and let you specify the icon and number/type of buttons.

colithium
+1  A: 

The MessageBox.Show method has a bunch of overrides that allow you to set the properties of the pop-up.

http://msdn.microsoft.com/en-us/library/system.windows.forms.messagebox.show%28VS.71%29.aspx

Andy White