仅显示错误对话框(MessageBox)并“关闭”或“取消”按钮?
我在 Windows 体验指南:错误消息中读到“ “确定”是错误对话框中显示的错误按钮。
...提供关闭按钮。 不要对错误消息使用“确定”,因为这种措辞意味着出现问题是可以解决的。
那么,如何使用单个关闭/取消按钮显示一个简单的错误对话框?
这可以通过标准 MessageBox
类还是我必须求助于自定义对话框(或库)或其他 Win32 消息/p-invoke“黑客”?
(< 中似乎没有任何相关内容code>MessageBoxButtons 枚举。)
谢谢。
I read in Windows Experience Guidelines: Error Messages that "OK" is an incorrect button to display on an error dialog.
...provide a Close button. Don't use OK for error messages, because this wording implies that problems are 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"?
(There doesn't seem to be anything relevant in the MessageBoxButtons
enumeration.)
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想要全面改进的
TaskDialog
。可从此处获取,此处使用说明
TaskDialog 允许您更详细地指定显示的按钮和图标是 Microsoft 自己的解决方案来解决您在 .Net 中遇到的问题。
-- 更新以回答 @pst 的评论
如果您必须支持 Winows XP 或更早版本,那么有一个 codeproject 上非常稳定可靠的库,当您使用早期版本的 Windows 时,它会包装并模拟 microsoft taskdialog 类,并且如果您使用的是 MS 自己的版本,则使用 MS 自己的版本您使用的是 Vista 或更高版本。
我大约 2 年前就依赖过这个 codeproject 库,当时它很稳定,所以应该不存在任何可靠性问题。
You want the all-improved
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.
-- update to answer @pst's comment
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.
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.