如何在.NET中显示错误和警告消息框/如何自定义MessageBox

cla*_*aws 73 .net c# winforms

使用C#.NET(Winforms).

我想知道如何在其中显示带有Ding!!声音和红色十字标记的消息框.这就是我所说的:

截图

如何为我的软件做这些事情,有自定义错误和自定义警告?

MessageBox.Show("asdf");
Run Code Online (Sandbox Code Playgroud)

不给我定制.

And*_*are 207

试试这个:

MessageBox.Show("Some text", "Some title", 
    MessageBoxButtons.OK, MessageBoxIcon.Error);
Run Code Online (Sandbox Code Playgroud)

  • MSDN:您可以使用的其他图标:http://msdn.microsoft.com/en-us/library/system.windows.forms.messageboxicon.aspx (6认同)
  • 现在它不支持MessageBoxIcon.Error.尝试像MessageBox.Show("Some text","Some title",MessageBoxButton.OK,MessageBoxImage.Warning); (2认同)

Aho*_*sik 18

尝试细节: 使用任何选项..

    MessageBox.Show("your message",
    "window title", 
    MessageBoxButtons.OK, 
    MessageBoxIcon.Warning // for Warning  
    //MessageBoxIcon.Error // for Error 
    //MessageBoxIcon.Information  // for Information
    //MessageBoxIcon.Question // for Question
   );
Run Code Online (Sandbox Code Playgroud)


小智 7

MessageBox.Show(
  "your message",
  "window title", 
  MessageBoxButtons.OK, 
  MessageBoxIcon.Asterisk //For Info Asterisk
  MessageBoxIcon.Exclamation //For triangle Warning 
)
Run Code Online (Sandbox Code Playgroud)