views:

43

answers:

1

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.

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

+2  A: 

Hi,

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

JonWillis