简体   繁体   English

显示错误对话框(MessageBox)只有“关闭”或“取消”按钮?

[英]Display error dialog (MessageBox) with Only “Close” or “Cancel” buttons?

I read in Windows Experience Guidelines: Error Messages that "OK" is an incorrect button to display on an error dialog. 我在Windows体验指南中读到:错误消息 “确定”是在错误对话框中显示的错误按钮。

...provide a Close button. ...提供关闭按钮。 Don't use OK for error messages , because this wording implies that problems are OK. 不要将OK用于错误消息 ,因为这个措辞暗示问题是可以的。

So, how can I display a simple error dialog with a single Close/Cancel button? 那么,如何使用单个“ 关闭/取消”按钮显示简单的错误对话框?

Is this possible with the standard MessageBox class or must I resort to custom dialog (or library) or other Win32 message / p-invoke "hacks"? 这可能与标准的MessageBox类有关,还是我必须使用自定义对话框(或库)或其他Win32消息/ p-invoke“hacks”?

(There doesn't seem to be anything relevant in the MessageBoxButtons enumeration.) MessageBoxButtons枚举中似乎没有任何相关内容。)

Thanks. 谢谢。

You want the all-improved TaskDialog . 你想要全改进的TaskDialog

Available from here with description on usage here 可在此处获取此处的使用说明

TaskDialog allows you to specify in more detail the buttons and icons that show and is microsoft's own solution to your problem in .Net. TaskDialog允许您更详细地指定显示的按钮和图标,并且是微软自己在.Net中解决问题的方法。

-- update to answer @pst's comment - 更新回答@pst的评论

If you have to support Winows XP or earlier then there is a very stable and reliable library on codeproject which wraps and emulates the microsoft taskdialog class when you are using an earlier version of windows, and uses MS's own version if you are on Vista or later. 如果你必须支持Winows XP或更早版本,那么codeproject上有一个非常稳定可靠的库,当你使用早期版本的windows时,它会包装和模拟microsoft taskdialog类,如果你在Vista或更高版本上,则使用MS自己的版本。

I have relied on this codeproject library approx 2 years ago, and it was stable then, so there should be no reliability issues at all. 大约2年前我依赖这个代码项目库,而且它稳定了,所以应该没有可靠性问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM