YESNO的MessageBox不关闭时的X按钮点击 [英] YesNo MessageBox not closing when x-button clicked

查看:822
本文介绍了YESNO的MessageBox不关闭时的X按钮点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打开一个消息框的选项YESNO时,在右上角(通常)取消交叉显示,但没有任何效果。

When I open a MessageBox with options YesNo, the (usually) cancelling cross in the upper right is shown but has no effect.

System.Windows.MessageBox.Show("Really, really?", "Are you sure?", MessageBoxButton.YesNo);

如果我提供YesNoCancel作为选项,点击交叉关闭对话与DialogResult的取消。

If I offer YesNoCancel as options, clicking the cross closes the Dialog with DialogResult Cancel.

System.Windows.MessageBox.Show("Really, really?", "Are you sure?", MessageBoxButton.YesNoCancel);

我本来期望的十字架寻找禁用如果不是隐藏在所有的,点击它没有效果的时候。 也许我不是第一个观察这一点。 什么是你最喜欢的方式隐藏/禁用此按钮或解决该问题?

I would have expected that the cross is "looking disabled" if not hidden at all, when clicking it has no effect. Probably I am not the first one observing this. What is your favorite way to hide/disable this button or workaround the issue?

注:我想preFER不使用System.Windows.Forms的一个解决方案,因为我处理的WPF项目,并希望避免任何互操作,如果可能的

Note: I would prefer a solution that does not use System.Windows.Forms, since I am dealing with WPF projects and would like to avoid any InterOp if possible.

推荐答案

的关闭按钮(MSGBOX的标题栏):由于MSGBOX窗口是一个内置在操作系统中的功能,允许它的X按钮仅在某些按钮是present。如果只有一个确定按钮,点击X按钮是相同的pressing行。否则,X按钮被禁用,除非有一个取消按钮,在这种情况下,点击X是相同的pressing取消。

The Close button (in MsgBox's title bar): Since the MsgBox window is a built-in feature of the operating system, its X button is enabled only when certain buttons are present. If there is only an OK button, clicking the X button is the same as pressing OK. Otherwise, the X button is disabled unless there is a Cancel button, in which case clicking the X is the same as pressing Cancel.

http://www.autohotkey.com/docs/commands/MsgBox.htm

它的默认行为!从时间是MSGBOX的时候了消息框!

Its the default behavior! from the time it was MsgBox to the time its MessageBox!

这篇关于YESNO的MessageBox不关闭时的X按钮点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆