使用HelpProvider类来显示帮助,用户界面​​总是在后面帮助窗口在后面、用户界面、窗口、HelpProvider

2023-09-04 12:10:50 作者:沦为旧友

我有一个C#的WinForms应用程序,使用HelpProvider类。 每当我preSS F1带来了帮助,帮助窗口将一直在我的应用程序的顶部,我不能让我的应用程序的用户界面到前台。我还可以用我的UI交互,但帮助窗口将保持在最前面。

I have a C# Winforms app that uses the HelpProvider class. Whenever i press F1 to bring up help, the help window will always be on top of my application, I cannot bring my application UI to the foreground. I can still interact with my UI, but the help window will remain on top.

通过HelpProvider的设计是什么?还是我失去了一些东西?

Is this by design of HelpProvider? Or am I missing something?

推荐答案

这的确是由设计,它是我没有意识到的东西。我刚刚重新编译了最后一年的项目,并证实了它。我已阅读了一下,基本上帮助文件在每次的形式被点击的时间设置为最顶层=真。这意味着即使你code的形式为你点击的帮助文件,它会再次走红是最顶层,尽快。

It is indeed by design, and its something that i did not realise. I have just recompiled my final year project and confirmed it. I have read up about it and basically the help file is set to TopMost=True every time the form is clicked. This means even if you code your form to be TopMost, as soon as you click the help file it will go back on top again.

我相信,如果你使用的启动过程中,它应该解决这个问题,在一些定制灵活性帮助供应商提供的损失。

I do believe if you use start process, it should get around the issue at the loss of some customisability the help provider gives.

private void textBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
  if(e.KeyCode ==Keys.F1)
  {
    System.Diagnostics.Process.Start(@"C:\WINDOWS\Help\mspaint.chm");
  }
}

希望它可以帮助

Hope it helps