November 25, 2007

Using HelpRequested

The following will get help related to the control which has the mouse over it by pressing the F1 button

this.HelpRequested += new HelpEventHandler(this.XXXDialog_HelpHandler);
...
private void XXXDialog_HelpHandler(
  object sender, HelpEventArgs helpEvent)
{
  if (helpEventHandler != null)
  {
    Point pt = this.PointToControl(e.MousePos);
    Control control = this.GetChildAtPoint(pt);
    
    GetHelpOn(control);

    helpEvent.Handled = true;
  }
}

No comments: