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

发布于 2024-12-29 05:16:49 字数 672 浏览 2 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁的年少不轻狂 2025-01-05 05:16:49

您想要全面改进的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文