【问题标题】:How to detect Help button press in Windows Forms MessageBox?如何检测 Windows 窗体 MessageBox 中的帮助按钮按下?
【发布时间】:2010-03-09 09:26:43
【问题描述】:

我有一个带有 3 个按钮的消息框:是、否、帮助:

var result = MessageBox.Show("text", "title",
                MessageBoxButtons.YesNo,
                MessageBoxIcon.Warning,
                MessageBoxDefaultButton.Button1,
                true);

我可以检测是/否按钮是否单击了类似这样的内容:

if(result == DialogResult.Yes)
    // some actions

如何检测帮助按钮被按下并执行我自己的代码?

【问题讨论】:

    标签: winforms messagebox


    【解决方案1】:

    您想处理表单的HelpRequested 事件。请参阅the help topic 中的示例。

    public static DialogResult Show(
        string text,
        string caption,
        MessageBoxButtons buttons,
        MessageBoxIcon icon,
        MessageBoxDefaultButton defaultButton,
        MessageBoxOptions options,
        bool displayHelpButton
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-15
      • 1970-01-01
      • 1970-01-01
      • 2013-06-05
      • 1970-01-01
      • 2015-01-01
      相关资源
      最近更新 更多