reaki
reaki

Reputation: 81

how to create windows7-styled message/dialog boxes with command links in c#?

How to create these beautiful message/dialog boxes (example: http://i.msdn.microsoft.com/dynimg/IC123363.png) in C#?

Is there a function similar to MessageBox.Show in the .NET Framework?

Upvotes: 8

Views: 3097

Answers (6)

Charlston Mabini Vita
Charlston Mabini Vita

Reputation: 174

Try to use Task Dialog. It is almost similar to MessageBox. Maybe you will like it. You just need to add the windowsAPIcode Pack to your reference and follow the instructions on the link i gave.

This site will be great help. http://www.developerfusion.com/article/71793/windows-7-task-dialogs/ Here is an example below: try it!

               // Get reference to the dialog type.
               var dialogTypeName = "System.Windows.Forms.PropertyGridInternal.GridErrorDlg";
               var dialogType = typeof(Form).Assembly.GetType(dialogTypeName);

               // Create dialog instance.
               var dialog = (Form)Activator.CreateInstance(dialogType, new PropertyGrid());

               // Populate relevant properties on the dialog instance.
               dialog.Text = "Data Patch";
               dialogType.GetProperty("Details").SetValue(dialog, "Sample Text", null);
               dialogType.GetProperty("Message").SetValue(dialog, "Sample Text", null);

               // Display dialog.
               var result = dialog.ShowDialog();

Pardon me @MegaTron for incomplete answer. I already revised it. I hope this answer will help also

Upvotes: -1

Greg D
Greg D

Reputation: 44096

I always hesitate to provide a codeproject link, but I think you're trying to make a TaskDialog. There's also a project on code.msdn.microsoft.com that claims to provide the WinForms TaskDialog. A more reliable source of the TaskDialog is the Windows API Code Pack.

Be certain to provide an alternate message box if you need to support WindowsXP or older operating systems, Task Dialogs are new in Windows Vista.

Upvotes: 4

STO
STO

Reputation: 10658

Take a look at http://code.msdn.microsoft.com/WindowsAPICodePack I'm not sure it contains feature you need, but it has feature named 'Windows Vista and Windows 7 Task Dialogs', maybe it is thing you looking for.

Upvotes: 2

Hans Passant
Hans Passant

Reputation: 942368

It is a TaskDialog. It is wrapped in a managed class by the Windows API Code Pack. Lots of other Vista and Win7 specific goodies in there as well.

Upvotes: 8

Edison Chuang
Edison Chuang

Reputation: 2921

You can make your own message windows form which appear what you want and show it with form show

MyMessageForm form = new MyMessageForm();
form.Show();

Upvotes: -1

Jake Kalstad
Jake Kalstad

Reputation: 2065

DevExpress is a mature 3rd party windows form provider that is worth a look if you are interested.

Upvotes: -2

Related Questions