开发者

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

开发者 https://www.devze.com 2023-01-04 15:23 出处:网络
How to create these beautiful message/dialog boxes (example: http://i.msdn.microsoft.com/dynimg/IC123363.png) 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 .N开发者_StackOverflow中文版ET Framework?


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.


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.


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.


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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消