的MessageBox.show味,显示了在任务栏上任务栏上、MessageBox、show

2023-09-04 05:31:23 作者:孤单哥

有没有办法来调用出现在任务栏的MessageBox.show?

Is there a way to call MessageBox.Show that appears in the taskbar?

这很可能是最好只创建一个自定义窗体并显示它当然,但作为一个懒惰的程序员我想避免重做默认的错误并提醒您得到一个良好的老式的MessageBox.show电话。通知图标

It would probably be best to just create a custom form and display it of course, but being a lazy programmer I want to avoid redoing the default Error and Alert notification icons you get with a good old fashioned MessageBox.Show call.

推荐答案

试试这个:

MessageBox.Show("Test", "Test", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1,  MessageBoxOptions.DefaultDesktopOnly);

查看 MessageBoxOptions 枚举。

注意:有一些多线程副作用的这一用法,请参阅文章如何显示用户界面有一个守护进程。

Note: There are some multi threading side effect to the usage of this, see the article How To Display A User Interface From A Daemon.