how to create windows7-styled message/dialog boxes

2019-04-23 10:48发布

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?

6条回答
再贱就再见
2楼-- · 2019-04-23 11:20

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.

查看更多
神经病院院长
3楼-- · 2019-04-23 11:22

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

查看更多
孤傲高冷的网名
4楼-- · 2019-04-23 11:29

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.

查看更多
女痞
5楼-- · 2019-04-23 11:31

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.

查看更多
叼着烟拽天下
6楼-- · 2019-04-23 11:31

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

查看更多
男人必须洒脱
7楼-- · 2019-04-23 11:40

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();
查看更多
登录 后发表回答