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

℡╲_俬逩灬. 提交于 2019-12-10 03:05:36

问题


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?


回答1:


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.




回答2:


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:


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.




回答4:


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();



回答5:


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




回答6:


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



来源:https://stackoverflow.com/questions/3121022/how-to-create-windows7-styled-message-dialog-boxes-with-command-links-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!