WPF 消息框显示错误消息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43938147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WPF Messagebox shows Error message
提问by Santhosh
I'm developing a WPF application and I want to show message box with symbol like information or question. I have written this code:
我正在开发一个 WPF 应用程序,我想显示带有信息或问题等符号的消息框。我写了这段代码:
MessageBox.Show("Added Sucessfully","Alert",MessageBoxImage.Information);
but it shows an error/red line:
但它显示错误/红线:
Error:system.windows.messagebox.show(string,string,messageboximage) has some invalid arguments
错误:system.windows.messagebox.show(string,string,messageboximage) 有一些无效的参数
回答by Yevgeniy
You have missed the MessageBoxButtonargument. Try the following:
你错过了MessageBoxButton辩论。请尝试以下操作:
MessageBox.Show("Added successfully", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
Make sure you are using MessageBoxfrom System.Windowsnamespace, not System.Windows.Forms.
确保您使用的是MessageBoxfromSystem.Windows命名空间,而不是System.Windows.Forms.

